From 76bc8aa107c7965eb4729b9d9369ccc5b744a94d Mon Sep 17 00:00:00 2001 From: djmaze Date: Tue, 19 Jan 2021 17:42:38 +0100 Subject: [PATCH] Disable removal of rainloop.user script --- dev/Model/SieveScript.js | 3 +++ dev/View/Popup/SieveScript.js | 5 ++--- .../0.0.0/app/templates/Views/User/PopupsSieveScript.html | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dev/Model/SieveScript.js b/dev/Model/SieveScript.js index cdc302949..c69811665 100644 --- a/dev/Model/SieveScript.js +++ b/dev/Model/SieveScript.js @@ -13,6 +13,7 @@ class SieveScriptModel extends AbstractModel active: false, body: '', + exists: false, nameError: false, bodyError: false, deleteAccess: false, @@ -72,6 +73,8 @@ class SieveScriptModel extends AbstractModel } else { script.filters([]); } + script.canBeDeleted(0 !== json.name.indexOf('rainloop.user')); + script.exists(true); script.hasChanges(false); } return script; diff --git a/dev/View/Popup/SieveScript.js b/dev/View/Popup/SieveScript.js index 87fda71b9..8ebe29e1f 100644 --- a/dev/View/Popup/SieveScript.js +++ b/dev/View/Popup/SieveScript.js @@ -21,7 +21,6 @@ class SieveScriptPopupView extends AbstractViewNext { super(); ko.addObservablesTo(this, { - isNew: true, saveError: false, saveErrorText: '', rawActive: false, @@ -42,7 +41,7 @@ class SieveScriptPopupView extends AbstractViewNext { return false; } - if (this.isNew() && SieveStore.scripts.find(item => item.name() === script.name())) { + if (!script.exists() && SieveStore.scripts.find(item => item.name() === script.name())) { script.nameError(true); return false; } @@ -55,6 +54,7 @@ class SieveScriptPopupView extends AbstractViewNext { this.saving = false; if (StorageResultType.Success === result && data && data.Result) { + script.exists(true); script.hasChanges(false); SieveStore.scripts.push(script); } else { @@ -119,7 +119,6 @@ class SieveScriptPopupView extends AbstractViewNext { onShow(oScript) { this.script(oScript); this.rawActive(!oScript.allowFilters()); - this.isNew(!oScript.name()); this.saveError(false); } diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsSieveScript.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsSieveScript.html index 269b27ff0..8f99d51f9 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/PopupsSieveScript.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsSieveScript.html @@ -3,8 +3,8 @@