Merge branch 'pr/3634'

allow-filter-duplicates
Jermolene 2019-02-05 16:21:06 +00:00
commit e5f3301c1c
2 zmienionych plików z 17 dodań i 2 usunięć

Wyświetl plik

@ -18,4 +18,6 @@ Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>
Upgrader/State/Suppressed: Blocked temporary state tiddler
Upgrader/System/Suppressed: Blocked system tiddler
Upgrader/System/Warning: Core module tiddler
Upgrader/System/Alert: You are about to import a tiddler that will overwrite a core module tiddler. This is not recommended as it may make the system unstable
Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<<from>>/>

Wyświetl plik

@ -13,11 +13,13 @@ Upgrader module that suppresses certain system tiddlers that shouldn't be import
"use strict";
var DONT_IMPORT_LIST = ["$:/StoryList","$:/HistoryList"],
DONT_IMPORT_PREFIX_LIST = ["$:/temp/","$:/state/"];
DONT_IMPORT_PREFIX_LIST = ["$:/temp/","$:/state/"],
WARN_IMPORT_PREFIX_LIST = ["$:/core/modules/"];
exports.upgrade = function(wiki,titles,tiddlers) {
var self = this,
messages = {};
messages = {},
showAlert = false;
// Check for tiddlers on our list
$tw.utils.each(titles,function(title) {
if(DONT_IMPORT_LIST.indexOf(title) !== -1) {
@ -31,6 +33,17 @@ exports.upgrade = function(wiki,titles,tiddlers) {
messages[title] = $tw.language.getString("Import/Upgrader/State/Suppressed");
}
}
for(var t=0; t<WARN_IMPORT_PREFIX_LIST.length; t++) {
var prefix = WARN_IMPORT_PREFIX_LIST[t];
if(title.substr(0,prefix.length) === prefix) {
showAlert = true;
messages[title] = $tw.language.getString("Import/Upgrader/System/Warning");
}
}
}
if(showAlert) {
var logger = new $tw.utils.Logger("import");
logger.alert($tw.language.getString("Import/Upgrader/System/Alert"));
}
});
return messages;