From c2cae9db0af9a59a83e1fac1f0bb695c379a3987 Mon Sep 17 00:00:00 2001 From: Bago Date: Thu, 26 Jan 2023 15:13:32 +0100 Subject: [PATCH] Fix regression preventing "incompatible template" popup to appear on loading Regression introduced in #4b9d9615898a84e263ed0a0b900ef138b93cd412 and released in 0.18.6 --- src/js/template-loader.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/js/template-loader.js b/src/js/template-loader.js index 0b2300bfc..c86f9305c 100644 --- a/src/js/template-loader.js +++ b/src/js/template-loader.js @@ -160,7 +160,19 @@ var templateLoader = function(performanceAwareCaller, templateFileName, template }); }; -var checkAndImportNewContentModel = function(performanceAwareCaller, content, allBlocks, newModel) { +var incompatibleTemplateDialog = function() { + $('#incompatible-template').dialog({ + modal: true, + appendTo: '#mo-body', + buttons: { + Ok: function() { + $(this).dialog("close"); + } + } + }); +}; + +var checkAndImportNewContentModel = function(performanceAwareCaller, content, allBlocks, newModel, silent) { var compatibleTemplate = true; // we run a basic compatibility check between the content-model we expect and the initialization model @@ -178,17 +190,7 @@ var checkAndImportNewContentModel = function(performanceAwareCaller, content, al compatibleTemplate = false; } - if (!compatibleTemplate) { - $('#incompatible-template').dialog({ - modal: true, - appendTo: '#mo-body', - buttons: { - Ok: function() { - $(this).dialog("close"); - } - } - }); - } + if ((typeof silent == 'undefined' || !silent) && !compatibleTemplate) incompatibleTemplateDialog(); return compatibleTemplate; }; @@ -333,6 +335,8 @@ var templateCompiler = function(performanceAwareCaller, templateUrlConverter, te pluginsCall(plugins, 'viewModel', [viewModel]); + if (incompatibleTemplate) incompatibleTemplateDialog(); + return { model: viewModel, init: function() {