mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Enable add/delete of Sieve scripts
This commit is contained in:
parent
1a07109d80
commit
ee37ad67bb
12 changed files with 24 additions and 22 deletions
|
|
@ -16,7 +16,7 @@ class SieveScriptModel extends AbstractModel
|
|||
nameError: false,
|
||||
bodyError: false,
|
||||
deleteAccess: false,
|
||||
canBeDeleted: false,
|
||||
canBeDeleted: true,
|
||||
hasChanges: false
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -67,26 +67,11 @@ class FiltersUserSettings {
|
|||
}
|
||||
|
||||
addScript() {
|
||||
const script = new SieveScriptModel();
|
||||
showScreenPopup(require('View/Popup/SieveScript'), [
|
||||
script,
|
||||
() => {
|
||||
if (!this.scripts[script.name]) {
|
||||
this.scripts[script.name] = script.name;
|
||||
}
|
||||
},
|
||||
false
|
||||
]);
|
||||
showScreenPopup(require('View/Popup/SieveScript'), [new SieveScriptModel()]);
|
||||
}
|
||||
|
||||
editScript(script) {
|
||||
showScreenPopup(require('View/Popup/SieveScript'), [
|
||||
script,
|
||||
() => {
|
||||
// TODO on save
|
||||
},
|
||||
true
|
||||
]);
|
||||
showScreenPopup(require('View/Popup/SieveScript'), [script]);
|
||||
}
|
||||
|
||||
deleteScript(script) {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ class SieveScriptPopupView extends AbstractViewNext {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (this.isNew() && SieveStore.scripts.find(item => item.name() === script.name())) {
|
||||
script.nameError(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.saving = true;
|
||||
this.saveError(false);
|
||||
|
||||
|
|
@ -51,6 +56,7 @@ class SieveScriptPopupView extends AbstractViewNext {
|
|||
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
script.hasChanges(false);
|
||||
SieveStore.scripts.push(script);
|
||||
} else {
|
||||
this.saveError(true);
|
||||
this.saveErrorText((data && data.ErrorCode)
|
||||
|
|
@ -110,11 +116,10 @@ class SieveScriptPopupView extends AbstractViewNext {
|
|||
});
|
||||
}
|
||||
|
||||
onShow(oScript, fTrueCallback, bEdit) {
|
||||
this.fTrueCallback = fTrueCallback;
|
||||
onShow(oScript) {
|
||||
this.script(oScript);
|
||||
this.rawActive(!oScript.allowFilters());
|
||||
this.isNew(!bEdit);
|
||||
this.isNew(!oScript.name());
|
||||
this.saveError(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue