mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Move addObservablesTo, addComputablesTo & addSubscribablesTo to Common/Utils
This commit is contained in:
parent
eda0ee695d
commit
4b6f6b1bfc
18 changed files with 55 additions and 46 deletions
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
|||
|
||||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { settingsSaveHelperSimpleFunction, defaultOptionsAfterRender } from 'Common/Utils';
|
||||
import { settingsSaveHelperSimpleFunction, defaultOptionsAfterRender, addObservablesTo } from 'Common/Utils';
|
||||
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
import { decorateKoCommands } from 'Knoin/Knoin';
|
||||
|
|
@ -11,7 +11,7 @@ export class ContactsAdminSettings {
|
|||
constructor() {
|
||||
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
addObservablesTo(this, {
|
||||
enableContacts: !!SettingsGet('ContactsEnable'),
|
||||
contactsSync: !!SettingsGet('ContactsSync'),
|
||||
contactsType: '',
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import {
|
|||
pInt,
|
||||
settingsSaveHelperSimpleFunction,
|
||||
changeTheme,
|
||||
convertThemeName
|
||||
convertThemeName,
|
||||
addObservablesTo,
|
||||
addSubscribablesTo
|
||||
} from 'Common/Utils';
|
||||
|
||||
import { Capa, SaveSettingsStep } from 'Common/Enums';
|
||||
|
|
@ -34,7 +36,7 @@ export class GeneralAdminSettings {
|
|||
this.theme = ThemeStore.theme;
|
||||
this.themes = ThemeStore.themes;
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
addObservablesTo(this, {
|
||||
allowLanguagesOnSettings: !!SettingsGet('AllowLanguagesOnSettings'),
|
||||
newMoveToFolder: !!SettingsGet('NewMoveToFolder'),
|
||||
attachmentLimitTrigger: SaveSettingsStep.Idle,
|
||||
|
|
@ -87,7 +89,7 @@ export class GeneralAdminSettings {
|
|||
Remote.saveAdminConfig(fn, data);
|
||||
};
|
||||
|
||||
ko.addSubscribablesTo(this, {
|
||||
addSubscribablesTo(this, {
|
||||
mainAttachmentLimit: value =>
|
||||
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.attachmentLimitTrigger, this), {
|
||||
'AttachmentLimit': pInt(value)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Settings, SettingsGet } from 'Common/Globals';
|
||||
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
|
||||
import { settingsSaveHelperSimpleFunction, addObservablesTo } from 'Common/Utils';
|
||||
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
|
||||
export class LoginAdminSettings {
|
||||
constructor() {
|
||||
ko.addObservablesTo(this, {
|
||||
addObservablesTo(this, {
|
||||
determineUserLanguage: !!SettingsGet('DetermineUserLanguage'),
|
||||
determineUserDomain: !!SettingsGet('DetermineUserDomain'),
|
||||
allowLanguagesOnLogin: !!SettingsGet('AllowLanguagesOnLogin'),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Capa } from 'Common/Enums';
|
||||
import { Settings, SettingsGet } from 'Common/Globals';
|
||||
import { addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||
|
||||
import { AppAdminStore } from 'Stores/Admin/App';
|
||||
|
||||
|
|
@ -13,7 +12,7 @@ export class SecurityAdminSettings {
|
|||
constructor() {
|
||||
this.weakPassword = AppAdminStore.weakPassword;
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
addObservablesTo(this, {
|
||||
useLocalProxyForExternalImages: !!SettingsGet('UseLocalProxyForExternalImages'),
|
||||
|
||||
verifySslCertificate: !!SettingsGet('VerifySslCertificate'),
|
||||
|
|
@ -38,7 +37,7 @@ export class SecurityAdminSettings {
|
|||
capaTwoFactorAuthForce: Settings.capa(Capa.TwoFactorForce)
|
||||
});
|
||||
|
||||
ko.addSubscribablesTo(this, {
|
||||
addSubscribablesTo(this, {
|
||||
adminPassword: () => {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
||||
import { Notification } from 'Common/Enums';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
import { addObservablesTo } from 'Common/Utils';
|
||||
import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
||||
|
||||
import { SieveUserStore } from 'Stores/User/Sieve';
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
|
@ -18,7 +19,7 @@ export class FiltersUserSettings {
|
|||
this.scripts = SieveUserStore.scripts;
|
||||
this.loading = ko.observable(false).extend({ debounce: 200 });
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
addObservablesTo(this, {
|
||||
serverError: false,
|
||||
serverErrorDesc: ''
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
|||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
|
||||
import { settingsSaveHelperSimpleFunction, addObservablesTo } from 'Common/Utils';
|
||||
import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
|
@ -47,7 +47,7 @@ export class GeneralUserSettings {
|
|||
this.languageFullName = ko.computed(() => convertLangName(this.language()));
|
||||
this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
addObservablesTo(this, {
|
||||
mppTrigger: SaveSettingsStep.Idle,
|
||||
editorDefaultTypeTrigger: SaveSettingsStep.Idle,
|
||||
layoutTrigger: SaveSettingsStep.Idle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue