mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
Code refactoring
This commit is contained in:
parent
79233ad83c
commit
286ab567af
53 changed files with 618 additions and 581 deletions
|
|
@ -112,7 +112,7 @@
|
|||
}
|
||||
|
||||
this.passwordUpdateError(true);
|
||||
this.errorDescription(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) :
|
||||
this.errorDescription(oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) :
|
||||
Translator.getNotification(Enums.Notification.CouldNotSaveNewPassword));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
var self = this;
|
||||
|
||||
this.modules = FilterStore.modules;
|
||||
this.filters = FilterStore.collection;
|
||||
this.filters = FilterStore.filters;
|
||||
|
||||
this.inited = ko.observable(false);
|
||||
this.serverError = ko.observable(false);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
this.showImages = SettingsStore.showImages;
|
||||
this.useCheckboxesInList = SettingsStore.useCheckboxesInList;
|
||||
this.threading = Data.threading;
|
||||
this.threadsAllowed = AppStore.threadsAllowed;
|
||||
this.useThreads = SettingsStore.useThreads;
|
||||
this.replySameFolder = SettingsStore.replySameFolder;
|
||||
this.allowLanguagesOnSettings = AppStore.allowLanguagesOnSettings;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
HtmlEditor = require('Common/HtmlEditor'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
IdentityStore = require('Stores/User/Identity'),
|
||||
|
||||
Data = require('Storage/User/Data'),
|
||||
|
|
@ -26,11 +27,12 @@
|
|||
this.editor = null;
|
||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||
|
||||
this.accountEmail = Data.accountEmail;
|
||||
this.displayName = Data.displayName;
|
||||
this.signature = Data.signature;
|
||||
this.signatureToAll = Data.signatureToAll;
|
||||
this.replyTo = Data.replyTo;
|
||||
this.accountEmail = AccountStore.email;
|
||||
|
||||
this.displayName = AccountStore.displayName;
|
||||
this.signature = AccountStore.signature;
|
||||
this.signatureToAll = AccountStore.signatureToAll;
|
||||
this.replyTo = AccountStore.replyTo;
|
||||
|
||||
this.signatureDom = ko.observable(null);
|
||||
|
||||
|
|
@ -52,7 +54,7 @@
|
|||
if (0 < aList.length)
|
||||
{
|
||||
aResult.push({
|
||||
'id': this.accountEmail.peek(),
|
||||
'id': AccountStore.email.peek(),
|
||||
'name': this.formattedAccountIdentity(),
|
||||
'seporator': false
|
||||
});
|
||||
|
|
@ -106,8 +108,8 @@
|
|||
IdentitiesUserSettings.prototype.formattedAccountIdentity = function ()
|
||||
{
|
||||
var
|
||||
sDisplayName = this.displayName.peek(),
|
||||
sEmail = this.accountEmail.peek()
|
||||
sDisplayName = AccountStore.displayName.peek(),
|
||||
sEmail = AccountStore.email.peek()
|
||||
;
|
||||
|
||||
return '' === sDisplayName ? sEmail : '"' + Utils.quoteName(sDisplayName) + '" <' + sEmail + '>';
|
||||
|
|
@ -151,11 +153,11 @@
|
|||
{
|
||||
var
|
||||
self = this,
|
||||
sSignature = Data.signature()
|
||||
sSignature = AccountStore.signature()
|
||||
;
|
||||
|
||||
this.editor = new HtmlEditor(self.signatureDom(), function () {
|
||||
Data.signature(
|
||||
AccountStore.signature(
|
||||
(self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
|
||||
);
|
||||
}, function () {
|
||||
|
|
@ -200,25 +202,25 @@
|
|||
});
|
||||
});
|
||||
|
||||
Data.displayName.subscribe(function (sValue) {
|
||||
AccountStore.displayName.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f1, {
|
||||
'DisplayName': sValue
|
||||
});
|
||||
});
|
||||
|
||||
Data.replyTo.subscribe(function (sValue) {
|
||||
AccountStore.replyTo.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f2, {
|
||||
'ReplyTo': sValue
|
||||
});
|
||||
});
|
||||
|
||||
Data.signature.subscribe(function (sValue) {
|
||||
AccountStore.signature.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f3, {
|
||||
'Signature': sValue
|
||||
});
|
||||
});
|
||||
|
||||
Data.signatureToAll.subscribe(function (bValue) {
|
||||
AccountStore.signatureToAll.subscribe(function (bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'SignatureToAll': bValue ? '1' : '0'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
Utils = require('Common/Utils'),
|
||||
HtmlEditor = require('Common/HtmlEditor'),
|
||||
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
|
||||
Data = require('Storage/User/Data'),
|
||||
Remote = require('Storage/User/Remote')
|
||||
;
|
||||
|
|
@ -22,10 +24,10 @@
|
|||
{
|
||||
this.editor = null;
|
||||
|
||||
this.displayName = Data.displayName;
|
||||
this.signature = Data.signature;
|
||||
this.signatureToAll = Data.signatureToAll;
|
||||
this.replyTo = Data.replyTo;
|
||||
this.displayName = AccountStore.displayName;
|
||||
this.signature = AccountStore.signature;
|
||||
this.signatureToAll = AccountStore.signatureToAll;
|
||||
this.replyTo = AccountStore.replyTo;
|
||||
|
||||
this.signatureDom = ko.observable(null);
|
||||
|
||||
|
|
@ -40,11 +42,11 @@
|
|||
{
|
||||
var
|
||||
self = this,
|
||||
sSignature = Data.signature()
|
||||
sSignature = AccountStore.signature()
|
||||
;
|
||||
|
||||
this.editor = new HtmlEditor(self.signatureDom(), function () {
|
||||
Data.signature(
|
||||
AccountStore.signature(
|
||||
(self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
|
||||
);
|
||||
}, function () {
|
||||
|
|
@ -71,25 +73,25 @@
|
|||
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
|
||||
;
|
||||
|
||||
Data.displayName.subscribe(function (sValue) {
|
||||
AccountStore.displayName.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f1, {
|
||||
'DisplayName': sValue
|
||||
});
|
||||
});
|
||||
|
||||
Data.replyTo.subscribe(function (sValue) {
|
||||
AccountStore.replyTo.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f2, {
|
||||
'ReplyTo': sValue
|
||||
});
|
||||
});
|
||||
|
||||
Data.signature.subscribe(function (sValue) {
|
||||
AccountStore.signature.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f3, {
|
||||
'Signature': sValue
|
||||
});
|
||||
});
|
||||
|
||||
Data.signatureToAll.subscribe(function (bValue) {
|
||||
AccountStore.signatureToAll.subscribe(function (bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'SignatureToAll': bValue ? '1' : '0'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
kn = require('Knoin/Knoin'),
|
||||
|
||||
Data = require('Storage/User/Data')
|
||||
PgpStore = require('Stores/User/Pgp')
|
||||
;
|
||||
|
||||
/**
|
||||
|
|
@ -19,9 +19,9 @@
|
|||
*/
|
||||
function OpenPgpUserSettings()
|
||||
{
|
||||
this.openpgpkeys = Data.openpgpkeys;
|
||||
this.openpgpkeysPublic = Data.openpgpkeysPublic;
|
||||
this.openpgpkeysPrivate = Data.openpgpkeysPrivate;
|
||||
this.openpgpkeys = PgpStore.openpgpkeys;
|
||||
this.openpgpkeysPublic = PgpStore.openpgpkeysPublic;
|
||||
this.openpgpkeysPrivate = PgpStore.openpgpkeysPrivate;
|
||||
|
||||
this.openPgpKeyForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this,
|
||||
function (oPrev) {
|
||||
|
|
@ -65,21 +65,21 @@
|
|||
{
|
||||
this.openPgpKeyForDeletion(null);
|
||||
|
||||
if (oOpenPgpKeyToRemove && Data.openpgpKeyring)
|
||||
if (oOpenPgpKeyToRemove && PgpStore.openpgpKeyring)
|
||||
{
|
||||
var oFindedItem = _.find(this.openpgpkeys(), function (oOpenPgpKey) {
|
||||
var oFindedItem = _.find(PgpStore.openpgpkeys(), function (oOpenPgpKey) {
|
||||
return oOpenPgpKeyToRemove === oOpenPgpKey;
|
||||
});
|
||||
|
||||
if (oFindedItem)
|
||||
{
|
||||
this.openpgpkeys.remove(oFindedItem);
|
||||
PgpStore.openpgpkeys.remove(oFindedItem);
|
||||
Utils.delegateRunOnDestroy(oFindedItem);
|
||||
|
||||
Data.openpgpKeyring[oFindedItem.isPrivate ? 'privateKeys' : 'publicKeys']
|
||||
PgpStore.openpgpKeyring[oFindedItem.isPrivate ? 'privateKeys' : 'publicKeys']
|
||||
.removeForId(oFindedItem.guid);
|
||||
|
||||
Data.openpgpKeyring.store();
|
||||
PgpStore.openpgpKeyring.store();
|
||||
}
|
||||
|
||||
require('App/User').reloadOpenPgpKeys();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
|
|
@ -65,12 +66,6 @@
|
|||
Remote.createTwoFactor(this.onResult);
|
||||
};
|
||||
|
||||
SecurityUserSettings.prototype.enableTwoFactor = function ()
|
||||
{
|
||||
this.processing(true);
|
||||
Remote.enableTwoFactor(this.onResult, this.viewEnable());
|
||||
};
|
||||
|
||||
SecurityUserSettings.prototype.testTwoFactor = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/TwoFactorTest'));
|
||||
|
|
@ -122,6 +117,7 @@
|
|||
if (this.bFirst)
|
||||
{
|
||||
this.bFirst = false;
|
||||
|
||||
var self = this;
|
||||
this.viewEnable.subscribe(function (bValue) {
|
||||
if (this.viewEnable.subs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue