mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Updated subscribables
This commit is contained in:
parent
4b6f6b1bfc
commit
004eba6be2
7 changed files with 200 additions and 219 deletions
|
|
@ -2,7 +2,12 @@ import ko from 'ko';
|
||||||
|
|
||||||
import { SaveSettingsStep } from 'Common/Enums';
|
import { SaveSettingsStep } from 'Common/Enums';
|
||||||
import { SettingsGet } from 'Common/Globals';
|
import { SettingsGet } from 'Common/Globals';
|
||||||
import { settingsSaveHelperSimpleFunction, defaultOptionsAfterRender, addObservablesTo } from 'Common/Utils';
|
import {
|
||||||
|
settingsSaveHelperSimpleFunction,
|
||||||
|
defaultOptionsAfterRender,
|
||||||
|
addObservablesTo,
|
||||||
|
addSubscribablesTo
|
||||||
|
} from 'Common/Utils';
|
||||||
|
|
||||||
import Remote from 'Remote/Admin/Fetch';
|
import Remote from 'Remote/Admin/Fetch';
|
||||||
import { decorateKoCommands } from 'Knoin/Knoin';
|
import { decorateKoCommands } from 'Knoin/Knoin';
|
||||||
|
|
@ -50,7 +55,7 @@ export class ContactsAdminSettings {
|
||||||
this.mainContactsType = ko
|
this.mainContactsType = ko
|
||||||
.computed({
|
.computed({
|
||||||
read: this.contactsType,
|
read: this.contactsType,
|
||||||
write: (value) => {
|
write: value => {
|
||||||
if (value !== this.contactsType()) {
|
if (value !== this.contactsType()) {
|
||||||
if (supportedTypes.includes(value)) {
|
if (supportedTypes.includes(value)) {
|
||||||
this.contactsType(value);
|
this.contactsType(value);
|
||||||
|
|
@ -64,11 +69,41 @@ export class ContactsAdminSettings {
|
||||||
})
|
})
|
||||||
.extend({ notify: 'always' });
|
.extend({ notify: 'always' });
|
||||||
|
|
||||||
this.contactsType.subscribe(() => {
|
addSubscribablesTo(this, {
|
||||||
|
enableContacts: value =>
|
||||||
|
Remote.saveAdminConfig(null, {
|
||||||
|
'ContactsEnable': value ? 1 : 0
|
||||||
|
}),
|
||||||
|
|
||||||
|
contactsSync: value =>
|
||||||
|
Remote.saveAdminConfig(null, {
|
||||||
|
'ContactsSync': value ? 1 : 0
|
||||||
|
}),
|
||||||
|
|
||||||
|
contactsType: value => {
|
||||||
this.testContactsSuccess(false);
|
this.testContactsSuccess(false);
|
||||||
this.testContactsError(false);
|
this.testContactsError(false);
|
||||||
this.testContactsErrorMessage('');
|
this.testContactsErrorMessage('');
|
||||||
});
|
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.contactsTypeTrigger, this), {
|
||||||
|
'ContactsPdoType': value.trim()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
pdoDsn: value =>
|
||||||
|
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this), {
|
||||||
|
'ContactsPdoDsn': value.trim()
|
||||||
|
}),
|
||||||
|
|
||||||
|
pdoUser: value =>
|
||||||
|
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.pdoUserTrigger, this), {
|
||||||
|
'ContactsPdoUser': value.trim()
|
||||||
|
}),
|
||||||
|
|
||||||
|
pdoPassword: value =>
|
||||||
|
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.pdoPasswordTrigger, this), {
|
||||||
|
'ContactsPdoPassword': value.trim()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
this.contactsType(SettingsGet('ContactsPdoType'));
|
this.contactsType(SettingsGet('ContactsPdoType'));
|
||||||
|
|
||||||
|
|
@ -117,51 +152,4 @@ export class ContactsAdminSettings {
|
||||||
this.testContactsError(false);
|
this.testContactsError(false);
|
||||||
this.testContactsErrorMessage('');
|
this.testContactsErrorMessage('');
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild() {
|
|
||||||
setTimeout(() => {
|
|
||||||
const f1 = settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this),
|
|
||||||
f3 = settingsSaveHelperSimpleFunction(this.pdoUserTrigger, this),
|
|
||||||
f4 = settingsSaveHelperSimpleFunction(this.pdoPasswordTrigger, this),
|
|
||||||
f5 = settingsSaveHelperSimpleFunction(this.contactsTypeTrigger, this);
|
|
||||||
|
|
||||||
this.enableContacts.subscribe((value) => {
|
|
||||||
Remote.saveAdminConfig(null, {
|
|
||||||
'ContactsEnable': value ? '1' : '0'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.contactsSync.subscribe((value) => {
|
|
||||||
Remote.saveAdminConfig(null, {
|
|
||||||
'ContactsSync': value ? '1' : '0'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.contactsType.subscribe((value) => {
|
|
||||||
Remote.saveAdminConfig(f5, {
|
|
||||||
'ContactsPdoType': value.trim()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.pdoDsn.subscribe((value) => {
|
|
||||||
Remote.saveAdminConfig(f1, {
|
|
||||||
'ContactsPdoDsn': value.trim()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.pdoUser.subscribe((value) => {
|
|
||||||
Remote.saveAdminConfig(f3, {
|
|
||||||
'ContactsPdoUser': value.trim()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.pdoPassword.subscribe((value) => {
|
|
||||||
Remote.saveAdminConfig(f4, {
|
|
||||||
'ContactsPdoPassword': value.trim()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.contactsType(SettingsGet('ContactsPdoType'));
|
|
||||||
}, 50);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { Settings, SettingsGet } from 'Common/Globals';
|
import { Settings, SettingsGet } from 'Common/Globals';
|
||||||
import { settingsSaveHelperSimpleFunction, addObservablesTo } from 'Common/Utils';
|
import { settingsSaveHelperSimpleFunction, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||||
|
|
||||||
import Remote from 'Remote/Admin/Fetch';
|
import Remote from 'Remote/Admin/Fetch';
|
||||||
|
|
||||||
|
|
@ -15,41 +15,32 @@ export class LoginAdminSettings {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.defaultDomain = ko.observable(SettingsGet('LoginDefaultDomain')).idleTrigger();
|
this.defaultDomain = ko.observable(SettingsGet('LoginDefaultDomain')).idleTrigger();
|
||||||
}
|
|
||||||
|
|
||||||
onBuild() {
|
addSubscribablesTo(this, {
|
||||||
setTimeout(() => {
|
determineUserLanguage: value =>
|
||||||
const f1 = settingsSaveHelperSimpleFunction(this.defaultDomain.trigger, this);
|
|
||||||
|
|
||||||
this.determineUserLanguage.subscribe(value =>
|
|
||||||
Remote.saveAdminConfig(null, {
|
Remote.saveAdminConfig(null, {
|
||||||
'DetermineUserLanguage': value ? '1' : '0'
|
'DetermineUserLanguage': value ? 1 : 0
|
||||||
})
|
}),
|
||||||
);
|
|
||||||
|
|
||||||
this.determineUserDomain.subscribe(value =>
|
determineUserDomain: value =>
|
||||||
Remote.saveAdminConfig(null, {
|
Remote.saveAdminConfig(null, {
|
||||||
'DetermineUserDomain': value ? '1' : '0'
|
'DetermineUserDomain': value ? 1 : 0
|
||||||
})
|
}),
|
||||||
);
|
|
||||||
|
|
||||||
this.allowLanguagesOnLogin.subscribe(value =>
|
allowLanguagesOnLogin: value =>
|
||||||
Remote.saveAdminConfig(null, {
|
Remote.saveAdminConfig(null, {
|
||||||
'AllowLanguagesOnLogin': value ? '1' : '0'
|
'AllowLanguagesOnLogin': value ? 1 : 0
|
||||||
})
|
}),
|
||||||
);
|
|
||||||
|
|
||||||
this.hideSubmitButton.subscribe(value =>
|
hideSubmitButton: value =>
|
||||||
Remote.saveAdminConfig(null, {
|
Remote.saveAdminConfig(null, {
|
||||||
'hideSubmitButton': value ? '1' : '0'
|
'hideSubmitButton': value ? 1 : 0
|
||||||
})
|
}),
|
||||||
);
|
|
||||||
|
|
||||||
this.defaultDomain.subscribe(value =>
|
defaultDomain: value =>
|
||||||
Remote.saveAdminConfig(f1, {
|
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.defaultDomain.trigger, this), {
|
||||||
'LoginDefaultDomain': value.trim()
|
'LoginDefaultDomain': value.trim()
|
||||||
})
|
})
|
||||||
);
|
});
|
||||||
}, 50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,12 @@ export class PluginsAdminSettings {
|
||||||
|
|
||||||
this.onPluginLoadRequest = this.onPluginLoadRequest.bind(this);
|
this.onPluginLoadRequest = this.onPluginLoadRequest.bind(this);
|
||||||
this.onPluginDisableRequest = this.onPluginDisableRequest.bind(this);
|
this.onPluginDisableRequest = this.onPluginDisableRequest.bind(this);
|
||||||
|
|
||||||
|
this.enabledPlugins.subscribe(value =>
|
||||||
|
Remote.saveAdminConfig(null, {
|
||||||
|
'EnabledPlugins': value ? 1 : 0
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
disablePlugin(plugin) {
|
disablePlugin(plugin) {
|
||||||
|
|
@ -40,12 +46,6 @@ export class PluginsAdminSettings {
|
||||||
el = event.target.closestWithin('.e-item .disabled-plugin', oDom);
|
el = event.target.closestWithin('.e-item .disabled-plugin', oDom);
|
||||||
el && ko.dataFor(el) && this.disablePlugin(ko.dataFor(el));
|
el && ko.dataFor(el) && this.disablePlugin(ko.dataFor(el));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.enabledPlugins.subscribe((value) => {
|
|
||||||
Remote.saveAdminConfig(null, {
|
|
||||||
'EnabledPlugins': value ? '1' : '0'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
|
||||||
|
|
@ -24,23 +24,21 @@ export class ContactsUserSettings {
|
||||||
].join('|')
|
].join('|')
|
||||||
)
|
)
|
||||||
.extend({ debounce: 500 });
|
.extend({ debounce: 500 });
|
||||||
}
|
|
||||||
|
|
||||||
onBuild() {
|
this.contactsAutosave.subscribe(value =>
|
||||||
this.contactsAutosave.subscribe((value) => {
|
|
||||||
Remote.saveSettings(null, {
|
Remote.saveSettings(null, {
|
||||||
'ContactsAutosave': value ? '1' : '0'
|
'ContactsAutosave': value ? 1 : 0
|
||||||
});
|
})
|
||||||
});
|
);
|
||||||
|
|
||||||
this.saveTrigger.subscribe(() => {
|
this.saveTrigger.subscribe(() =>
|
||||||
Remote.saveContactsSyncData(
|
Remote.saveContactsSyncData(
|
||||||
null,
|
null,
|
||||||
ContactUserStore.enableSync(),
|
ContactUserStore.enableSync(),
|
||||||
ContactUserStore.syncUrl(),
|
ContactUserStore.syncUrl(),
|
||||||
ContactUserStore.syncUser(),
|
ContactUserStore.syncUser(),
|
||||||
ContactUserStore.syncPass()
|
ContactUserStore.syncPass()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
||||||
import { SaveSettingsStep } from 'Common/Enums';
|
import { SaveSettingsStep } from 'Common/Enums';
|
||||||
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
|
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
|
||||||
import { SettingsGet } from 'Common/Globals';
|
import { SettingsGet } from 'Common/Globals';
|
||||||
import { settingsSaveHelperSimpleFunction, addObservablesTo } from 'Common/Utils';
|
import { settingsSaveHelperSimpleFunction, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||||
import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator';
|
import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator';
|
||||||
|
|
||||||
import { showScreenPopup } from 'Knoin/Knoin';
|
import { showScreenPopup } from 'Knoin/Knoin';
|
||||||
|
|
@ -83,6 +83,68 @@ export class GeneralUserSettings {
|
||||||
{ 'id': Layout.BottomPreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT') }
|
{ 'id': Layout.BottomPreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT') }
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const fReloadLanguageHelper = (saveSettingsStep) => () => {
|
||||||
|
this.languageTrigger(saveSettingsStep);
|
||||||
|
setTimeout(() => this.languageTrigger(SaveSettingsStep.Idle), 1000);
|
||||||
|
};
|
||||||
|
addSubscribablesTo(this, {
|
||||||
|
language: value => {
|
||||||
|
this.languageTrigger(SaveSettingsStep.Animate);
|
||||||
|
translatorReload(false, value)
|
||||||
|
.then(fReloadLanguageHelper(SaveSettingsStep.TrueResult), fReloadLanguageHelper(SaveSettingsStep.FalseResult))
|
||||||
|
.then(() => {
|
||||||
|
Remote.saveSettings(null, {
|
||||||
|
'Language': value
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
editorDefaultType:
|
||||||
|
Remote.saveSettingsHelper('EditorDefaultType', null,
|
||||||
|
settingsSaveHelperSimpleFunction(this.editorDefaultTypeTrigger, this)),
|
||||||
|
|
||||||
|
messagesPerPage: Remote.saveSettingsHelper('MPP', null, settingsSaveHelperSimpleFunction(this.mppTrigger, this)),
|
||||||
|
|
||||||
|
showImages: Remote.saveSettingsHelper('ShowImages', v=>v?'1':'0'),
|
||||||
|
|
||||||
|
removeColors: Remote.saveSettingsHelper('RemoveColors', v=>v?'1':'0'),
|
||||||
|
|
||||||
|
useCheckboxesInList: Remote.saveSettingsHelper('UseCheckboxesInList', v=>v?'1':'0'),
|
||||||
|
|
||||||
|
enableDesktopNotification: (value =>
|
||||||
|
Remote.saveSettings(null, {
|
||||||
|
'DesktopNotifications': value ? 1 : 0
|
||||||
|
})
|
||||||
|
).debounce(3000),
|
||||||
|
|
||||||
|
enableSoundNotification: (value =>
|
||||||
|
Remote.saveSettings(null, {
|
||||||
|
'SoundNotification': value ? 1 : 0
|
||||||
|
})
|
||||||
|
).debounce(3000),
|
||||||
|
|
||||||
|
replySameFolder: (value =>
|
||||||
|
Remote.saveSettings(null, {
|
||||||
|
'ReplySameFolder': value ? 1 : 0
|
||||||
|
})
|
||||||
|
).debounce(3000),
|
||||||
|
|
||||||
|
useThreads: value => {
|
||||||
|
MessageUserStore.list([]);
|
||||||
|
Remote.saveSettings(null, {
|
||||||
|
'UseThreads': value ? 1 : 0
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
layout: value => {
|
||||||
|
MessageUserStore.list([]);
|
||||||
|
Remote.saveSettings(settingsSaveHelperSimpleFunction(this.layoutTrigger, this), {
|
||||||
|
'Layout': value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
editMainIdentity() {
|
editMainIdentity() {
|
||||||
|
|
@ -100,68 +162,6 @@ export class GeneralUserSettings {
|
||||||
NotificationUserStore.displayDesktopNotification('SnappyMail', 'Test notification', { });
|
NotificationUserStore.displayDesktopNotification('SnappyMail', 'Test notification', { });
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild() {
|
|
||||||
setTimeout(() => {
|
|
||||||
const f0 = settingsSaveHelperSimpleFunction(this.editorDefaultTypeTrigger, this),
|
|
||||||
f1 = settingsSaveHelperSimpleFunction(this.mppTrigger, this),
|
|
||||||
f2 = settingsSaveHelperSimpleFunction(this.layoutTrigger, this),
|
|
||||||
fReloadLanguageHelper = (saveSettingsStep) => () => {
|
|
||||||
this.languageTrigger(saveSettingsStep);
|
|
||||||
setTimeout(() => this.languageTrigger(SaveSettingsStep.Idle), 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.language.subscribe((value) => {
|
|
||||||
this.languageTrigger(SaveSettingsStep.Animate);
|
|
||||||
translatorReload(false, value)
|
|
||||||
.then(fReloadLanguageHelper(SaveSettingsStep.TrueResult), fReloadLanguageHelper(SaveSettingsStep.FalseResult))
|
|
||||||
.then(() => {
|
|
||||||
Remote.saveSettings(null, {
|
|
||||||
'Language': value
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.editorDefaultType.subscribe(Remote.saveSettingsHelper('EditorDefaultType', null, f0));
|
|
||||||
this.messagesPerPage.subscribe(Remote.saveSettingsHelper('MPP', null, f1));
|
|
||||||
this.showImages.subscribe(Remote.saveSettingsHelper('ShowImages', v=>v?'1':'0'));
|
|
||||||
this.removeColors.subscribe(Remote.saveSettingsHelper('RemoveColors', v=>v?'1':'0'));
|
|
||||||
|
|
||||||
this.useCheckboxesInList.subscribe(Remote.saveSettingsHelper('UseCheckboxesInList', v=>v?'1':'0'));
|
|
||||||
|
|
||||||
this.enableDesktopNotification.subscribe((value =>
|
|
||||||
Remote.saveSettings(null, {
|
|
||||||
'DesktopNotifications': value ? 1 : 0
|
|
||||||
})
|
|
||||||
).debounce(3000));
|
|
||||||
|
|
||||||
this.enableSoundNotification.subscribe((value =>
|
|
||||||
Remote.saveSettings(null, {
|
|
||||||
'SoundNotification': value ? 1 : 0
|
|
||||||
})
|
|
||||||
).debounce(3000));
|
|
||||||
|
|
||||||
this.replySameFolder.subscribe((value =>
|
|
||||||
Remote.saveSettings(null, {
|
|
||||||
'ReplySameFolder': value ? 1 : 0
|
|
||||||
})
|
|
||||||
).debounce(3000));
|
|
||||||
|
|
||||||
this.useThreads.subscribe((value) => {
|
|
||||||
MessageUserStore.list([]);
|
|
||||||
Remote.saveSettings(null, {
|
|
||||||
'UseThreads': value ? 1 : 0
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.layout.subscribe((value) => {
|
|
||||||
MessageUserStore.list([]);
|
|
||||||
Remote.saveSettings(f2, {
|
|
||||||
'Layout': value
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}, 50);
|
|
||||||
}
|
|
||||||
|
|
||||||
selectLanguage() {
|
selectLanguage() {
|
||||||
showScreenPopup(LanguagesPopupView, [this.language, this.languages(), LanguageStore.userLanguage()]);
|
showScreenPopup(LanguagesPopupView, [this.language, this.languages(), LanguageStore.userLanguage()]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
||||||
|
|
||||||
import { FolderType } from 'Common/EnumsUser';
|
import { FolderType } from 'Common/EnumsUser';
|
||||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||||
import { addObservablesTo } from 'Common/Utils';
|
import { addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||||
import { folderListOptionsBuilder } from 'Common/UtilsUser';
|
import { folderListOptionsBuilder } from 'Common/UtilsUser';
|
||||||
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
|
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
|
||||||
import { SettingsGet } from 'Common/Globals';
|
import { SettingsGet } from 'Common/Globals';
|
||||||
|
|
@ -125,13 +125,14 @@ export const FolderUserStore = new class {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const fRemoveSystemFolderType = (observable) => () => {
|
const
|
||||||
|
fRemoveSystemFolderType = (observable) => () => {
|
||||||
const folder = getFolderFromCacheList(observable());
|
const folder = getFolderFromCacheList(observable());
|
||||||
if (folder) {
|
if (folder) {
|
||||||
folder.type(FolderType.User);
|
folder.type(FolderType.User);
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
const fSetSystemFolderType = (type) => (value) => {
|
fSetSystemFolderType = type => value => {
|
||||||
const folder = getFolderFromCacheList(value);
|
const folder = getFolderFromCacheList(value);
|
||||||
if (folder) {
|
if (folder) {
|
||||||
folder.type(type);
|
folder.type(type);
|
||||||
|
|
@ -144,11 +145,13 @@ export const FolderUserStore = new class {
|
||||||
this.trashFolder.subscribe(fRemoveSystemFolderType(this.trashFolder), this, 'beforeChange');
|
this.trashFolder.subscribe(fRemoveSystemFolderType(this.trashFolder), this, 'beforeChange');
|
||||||
this.archiveFolder.subscribe(fRemoveSystemFolderType(this.archiveFolder), this, 'beforeChange');
|
this.archiveFolder.subscribe(fRemoveSystemFolderType(this.archiveFolder), this, 'beforeChange');
|
||||||
|
|
||||||
this.sentFolder.subscribe(fSetSystemFolderType(FolderType.SentItems), this);
|
addSubscribablesTo(this, {
|
||||||
this.draftFolder.subscribe(fSetSystemFolderType(FolderType.Draft), this);
|
sentFolder: fSetSystemFolderType(FolderType.SentItems),
|
||||||
this.spamFolder.subscribe(fSetSystemFolderType(FolderType.Spam), this);
|
draftFolder: fSetSystemFolderType(FolderType.Draft),
|
||||||
this.trashFolder.subscribe(fSetSystemFolderType(FolderType.Trash), this);
|
spamFolder: fSetSystemFolderType(FolderType.Spam),
|
||||||
this.archiveFolder.subscribe(fSetSystemFolderType(FolderType.Archive), this);
|
trashFolder: fSetSystemFolderType(FolderType.Trash),
|
||||||
|
archiveFolder: fSetSystemFolderType(FolderType.Archive)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import ko from 'ko';
|
||||||
import { Notification } from 'Common/Enums';
|
import { Notification } from 'Common/Enums';
|
||||||
import { Focused, MessageSetAction } from 'Common/EnumsUser';
|
import { Focused, MessageSetAction } from 'Common/EnumsUser';
|
||||||
import { doc, elementById } from 'Common/Globals';
|
import { doc, elementById } from 'Common/Globals';
|
||||||
import { pInt, pString, addObservablesTo } from 'Common/Utils';
|
import { pInt, pString, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
|
||||||
import { plainToHtml } from 'Common/UtilsUser';
|
import { plainToHtml } from 'Common/UtilsUser';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -170,7 +170,9 @@ export const MessageUserStore = new class {
|
||||||
// Subscribers
|
// Subscribers
|
||||||
|
|
||||||
let timer = 0, fn = this.listLoadingAnimation;
|
let timer = 0, fn = this.listLoadingAnimation;
|
||||||
this.listCompleteLoading.subscribe(value => {
|
|
||||||
|
addSubscribablesTo(this, {
|
||||||
|
listCompleteLoading: value => {
|
||||||
if (value) {
|
if (value) {
|
||||||
fn(value);
|
fn(value);
|
||||||
} else if (fn()) {
|
} else if (fn()) {
|
||||||
|
|
@ -182,24 +184,22 @@ export const MessageUserStore = new class {
|
||||||
} else {
|
} else {
|
||||||
fn(value);
|
fn(value);
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
|
||||||
this.listLoading.subscribe(value =>
|
listLoading: value =>
|
||||||
this.listCompleteLoading(value || this.listIsNotCompleted())
|
this.listCompleteLoading(value || this.listIsNotCompleted()),
|
||||||
);
|
|
||||||
this.listIsNotCompleted.subscribe(value =>
|
|
||||||
this.listCompleteLoading(value || this.listLoading())
|
|
||||||
);
|
|
||||||
|
|
||||||
this.list.subscribe(
|
listIsNotCompleted: value =>
|
||||||
|
this.listCompleteLoading(value || this.listLoading()),
|
||||||
|
|
||||||
|
list:
|
||||||
(list => {
|
(list => {
|
||||||
list.forEach(item =>
|
list.forEach(item =>
|
||||||
item && item.newForAnimation() && item.newForAnimation(false)
|
item && item.newForAnimation() && item.newForAnimation(false)
|
||||||
)
|
)
|
||||||
}).debounce(500)
|
}).debounce(500),
|
||||||
);
|
|
||||||
|
|
||||||
this.message.subscribe(message => {
|
message: message => {
|
||||||
if (message) {
|
if (message) {
|
||||||
if (!SettingsUserStore.usePreviewPane()) {
|
if (!SettingsUserStore.usePreviewPane()) {
|
||||||
AppUserStore.focusedState(Focused.MessageView);
|
AppUserStore.focusedState(Focused.MessageView);
|
||||||
|
|
@ -210,13 +210,14 @@ export const MessageUserStore = new class {
|
||||||
this.messageFullScreenMode(false);
|
this.messageFullScreenMode(false);
|
||||||
this.hideMessageBodies();
|
this.hideMessageBodies();
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
|
||||||
this.listEndFolder.subscribe(folder => {
|
listEndFolder: folder => {
|
||||||
const message = this.message();
|
const message = this.message();
|
||||||
if (message && folder && folder !== message.folder) {
|
if (message && folder && folder !== message.folder) {
|
||||||
this.message(null);
|
this.message(null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onMessageResponse = this.onMessageResponse.bind(this);
|
this.onMessageResponse = this.onMessageResponse.bind(this);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue