mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
Preparations for #1689
This commit is contained in:
parent
d2f3aa1c10
commit
166b790a3e
4 changed files with 18 additions and 11 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
||||||
|
|
||||||
|
import { showScreenPopup } from 'Knoin/Knoin';
|
||||||
|
import { IdentityPopupView } from 'View/Popup/Identity';
|
||||||
|
|
||||||
export class IdentityModel extends AbstractModel {
|
export class IdentityModel extends AbstractModel {
|
||||||
/**
|
/**
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
|
|
@ -47,4 +50,8 @@ export class IdentityModel extends AbstractModel {
|
||||||
label = this.label();
|
label = this.label();
|
||||||
return (name ? `${name} ` : '') + `<${email}>` + (label ? ` (${label})` : '');
|
return (name ? `${name} ` : '') + `<${email}>` + (label ? ` (${label})` : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edit() {
|
||||||
|
showScreenPopup(IdentityPopupView, [this]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
|
||||||
}
|
}
|
||||||
|
|
||||||
editIdentity(identity) {
|
editIdentity(identity) {
|
||||||
showScreenPopup(IdentityPopupView, [identity]);
|
identity.edit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import { LayoutSideView, LayoutBottomView } from 'Common/EnumsUser';
|
||||||
import { setRefreshFoldersInterval } from 'Common/Folders';
|
import { setRefreshFoldersInterval } from 'Common/Folders';
|
||||||
import { Settings, SettingsGet } from 'Common/Globals';
|
import { Settings, SettingsGet } from 'Common/Globals';
|
||||||
import { WYSIWYGS } from 'Common/HtmlEditor';
|
import { WYSIWYGS } from 'Common/HtmlEditor';
|
||||||
import { isArray } from 'Common/Utils';
|
|
||||||
import { addSubscribablesTo, addComputablesTo } from 'External/ko';
|
import { addSubscribablesTo, addComputablesTo } from 'External/ko';
|
||||||
import { i18n, translateTrigger, translatorReload, convertLangName } from 'Common/Translator';
|
import { i18n, translateTrigger, translatorReload, convertLangName } from 'Common/Translator';
|
||||||
|
|
||||||
|
|
@ -23,7 +22,6 @@ import { MessagelistUserStore } from 'Stores/User/Messagelist';
|
||||||
|
|
||||||
import Remote from 'Remote/User/Fetch';
|
import Remote from 'Remote/User/Fetch';
|
||||||
|
|
||||||
import { IdentityPopupView } from 'View/Popup/Identity';
|
|
||||||
import { LanguagesPopupView } from 'View/Popup/Languages';
|
import { LanguagesPopupView } from 'View/Popup/Languages';
|
||||||
|
|
||||||
export class UserSettingsGeneral extends AbstractViewSettings {
|
export class UserSettingsGeneral extends AbstractViewSettings {
|
||||||
|
|
@ -75,13 +73,8 @@ export class UserSettingsGeneral extends AbstractViewSettings {
|
||||||
addComputablesTo(this, {
|
addComputablesTo(this, {
|
||||||
languageFullName: () => convertLangName(this.language()),
|
languageFullName: () => convertLangName(this.language()),
|
||||||
|
|
||||||
identityMain: () => {
|
|
||||||
const list = this.identities();
|
|
||||||
return isArray(list) ? list.find(item => item && !item.id()) : null;
|
|
||||||
},
|
|
||||||
|
|
||||||
identityMainDesc: () => {
|
identityMainDesc: () => {
|
||||||
const identity = this.identityMain();
|
const identity = IdentityUserStore.main();
|
||||||
return identity ? identity.formattedName() : '---';
|
return identity ? identity.formattedName() : '---';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -168,8 +161,7 @@ export class UserSettingsGeneral extends AbstractViewSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
editMainIdentity() {
|
editMainIdentity() {
|
||||||
const identity = this.identityMain();
|
IdentityUserStore.main()?.edit?.();
|
||||||
identity && showScreenPopup(IdentityPopupView, [identity]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
testSoundNotification() {
|
testSoundNotification() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,13 @@
|
||||||
import { koArrayWithDestroy } from 'External/ko';
|
import { koArrayWithDestroy } from 'External/ko';
|
||||||
|
import { koComputable } from 'External/ko';
|
||||||
|
import { isArray } from 'Common/Utils';
|
||||||
|
|
||||||
export const IdentityUserStore = koArrayWithDestroy();
|
export const IdentityUserStore = koArrayWithDestroy();
|
||||||
|
|
||||||
IdentityUserStore.loading = ko.observable(false).extend({ debounce: 100 });
|
IdentityUserStore.loading = ko.observable(false).extend({ debounce: 100 });
|
||||||
|
|
||||||
|
/** Returns main (login) identity */
|
||||||
|
IdentityUserStore.main = koComputable(() => {
|
||||||
|
const list = IdentityUserStore();
|
||||||
|
return isArray(list) ? list.find(item => item && !item.id()) : null;
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue