mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Fix Sieve Circular dependency
This commit is contained in:
parent
ea25d9bce4
commit
9bae77bfa1
2 changed files with 34 additions and 36 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import { SieveScriptModel } from 'Sieve/Model/Script';
|
||||
|
||||
export const
|
||||
// import { i18n } from 'Common/Translator';
|
||||
i18n = rl.i18n,
|
||||
|
|
@ -58,32 +56,4 @@ export const
|
|||
setError = text => {
|
||||
serverError(true);
|
||||
serverErrorDesc(text);
|
||||
},
|
||||
|
||||
updateList = () => {
|
||||
if (!loading()) {
|
||||
loading(true);
|
||||
serverError(false);
|
||||
|
||||
Remote.request('Filters', (iError, data) => {
|
||||
loading(false);
|
||||
scripts([]);
|
||||
|
||||
if (iError) {
|
||||
capa([]);
|
||||
setError(getNotification(iError));
|
||||
} else {
|
||||
capa(data.Result.Capa);
|
||||
/*
|
||||
scripts(
|
||||
data.Result.Scripts.map(aItem => SieveScriptModel.reviveFromJson(aItem)).filter(v => v)
|
||||
);
|
||||
*/
|
||||
forEachObjectValue(data.Result.Scripts, value => {
|
||||
value = SieveScriptModel.reviveFromJson(value);
|
||||
value && scripts.push(value)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
40
dev/sieve.js
40
dev/sieve.js
|
|
@ -1,15 +1,16 @@
|
|||
import {
|
||||
capa,
|
||||
scripts,
|
||||
forEachObjectValue,
|
||||
getNotification,
|
||||
loading,
|
||||
Remote,
|
||||
scripts,
|
||||
serverError,
|
||||
serverErrorDesc,
|
||||
setError,
|
||||
updateList,
|
||||
getNotification,
|
||||
Remote
|
||||
setError
|
||||
} from 'Sieve/Utils';
|
||||
|
||||
import { SieveScriptModel } from 'Sieve/Model/Script';
|
||||
import { SieveScriptPopupView } from 'Sieve/View/Script';
|
||||
|
||||
// SieveUserStore
|
||||
|
|
@ -17,7 +18,6 @@ window.Sieve = {
|
|||
capa: capa,
|
||||
scripts: scripts,
|
||||
setError: setError,
|
||||
updateList: updateList,
|
||||
loading: loading,
|
||||
serverError: serverError,
|
||||
serverErrorDesc: serverErrorDesc,
|
||||
|
|
@ -25,6 +25,34 @@ window.Sieve = {
|
|||
|
||||
folderList: null,
|
||||
|
||||
updateList: () => {
|
||||
if (!loading()) {
|
||||
loading(true);
|
||||
serverError(false);
|
||||
|
||||
Remote.request('Filters', (iError, data) => {
|
||||
loading(false);
|
||||
scripts([]);
|
||||
|
||||
if (iError) {
|
||||
capa([]);
|
||||
setError(getNotification(iError));
|
||||
} else {
|
||||
capa(data.Result.Capa);
|
||||
/*
|
||||
scripts(
|
||||
data.Result.Scripts.map(aItem => SieveScriptModel.reviveFromJson(aItem)).filter(v => v)
|
||||
);
|
||||
*/
|
||||
forEachObjectValue(data.Result.Scripts, value => {
|
||||
value = SieveScriptModel.reviveFromJson(value);
|
||||
value && scripts.push(value)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
deleteScript: script => {
|
||||
serverError(false);
|
||||
Remote.request('FiltersScriptDelete',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue