Add "Automatically save draft" option

This commit is contained in:
RainLoop Team 2017-06-28 19:25:53 +03:00
parent 8da988fef2
commit 45fe0217f2
7 changed files with 40 additions and 6 deletions

View file

@ -2,10 +2,14 @@
import _ from '_';
import ko from 'ko';
import {delegateRunOnDestroy} from 'Common/Utils';
import {delegateRunOnDestroy, boolToAjax} from 'Common/Utils';
import {Magics} from 'Common/Enums';
import {bIsHttps} from 'Common/Globals';
import PgpStore from 'Stores/User/Pgp';
import SettingsStore from 'Stores/User/Settings';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
@ -20,6 +24,8 @@ class OpenPgpUserSettings
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
this.allowDraftAutosave = SettingsStore.allowDraftAutosave;
this.isHttps = bIsHttps;
}
@ -66,6 +72,16 @@ class OpenPgpUserSettings
}
}
}
onBuild() {
_.delay(() => {
this.allowDraftAutosave.subscribe(
Remote.saveSettingsHelper('AllowDraftAutosave', boolToAjax)
);
}, Magics.Time50ms);
}
}
export {OpenPgpUserSettings, OpenPgpUserSettings as default};