1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Indicate in import listing whether a plugin contains JS modules

This commit is contained in:
Jeremy Ruston 2019-09-17 08:49:39 +01:00
parent 83954582f4
commit 336f1ceae3

View File

@ -39,12 +39,16 @@ exports.upgrade = function(wiki,titles,tiddlers) {
$tw.utils.each(titles,function(title) {
var incomingTiddler = tiddlers[title];
// Check if we're dealing with a plugin
if(incomingTiddler && incomingTiddler["plugin-type"] && incomingTiddler.version) {
if(incomingTiddler && incomingTiddler["plugin-type"]) {
// Check whether the plugin contains JS modules
var doesContainJavaScript = $tw.wiki.doesPluginInfoContainModules(JSON.parse(incomingTiddler.text)) ? ($tw.wiki.getTiddlerText("$:/language/ControlPanel/Plugins/PluginWillRequireReload") + " ") : "";
messages[title] = doesContainJavaScript;
if(incomingTiddler.version) {
// Upgrade the incoming plugin if it is in the upgrade library
var libraryTiddler = getLibraryTiddler(title);
if(libraryTiddler && libraryTiddler["plugin-type"] && libraryTiddler.version) {
tiddlers[title] = libraryTiddler;
messages[title] = $tw.language.getString("Import/Upgrader/Plugins/Upgraded",{variables: {incoming: incomingTiddler.version, upgraded: libraryTiddler.version}});
messages[title] = doesContainJavaScript + $tw.language.getString("Import/Upgrader/Plugins/Upgraded",{variables: {incoming: incomingTiddler.version, upgraded: libraryTiddler.version}});
return;
}
// Suppress the incoming plugin if it is older than the currently installed one
@ -53,12 +57,11 @@ exports.upgrade = function(wiki,titles,tiddlers) {
// Reject the incoming plugin by blanking all its fields
if($tw.utils.checkVersions(existingTiddler.fields.version,incomingTiddler.version)) {
tiddlers[title] = Object.create(null);
messages[title] = $tw.language.getString("Import/Upgrader/Plugins/Suppressed/Version",{variables: {incoming: incomingTiddler.version, existing: existingTiddler.fields.version}});
messages[title] = doesContainJavaScript + $tw.language.getString("Import/Upgrader/Plugins/Suppressed/Version",{variables: {incoming: incomingTiddler.version, existing: existingTiddler.fields.version}});
return;
}
}
}
if(incomingTiddler && incomingTiddler["plugin-type"]) {
// Check whether the plugin is on the blocked list
var blockInfo = BLOCKED_PLUGINS[title];
if(blockInfo) {