mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Resolve #1689
This commit is contained in:
parent
3fb700f163
commit
aa52d2e8f8
|
@ -88,6 +88,8 @@ export class AppUser extends AbstractApp {
|
|||
this.messageList = MessagelistUserStore;
|
||||
|
||||
this.ask = AskPopupView;
|
||||
|
||||
this.loadAccountsAndIdentities = loadAccountsAndIdentities;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,6 +18,9 @@ import { AccountUserStore } from 'Stores/User/Account';
|
|||
import { IdentityUserStore } from 'Stores/User/Identity';
|
||||
import { isArray } from 'Common/Utils';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
import { IdentityPopupView } from 'View/Popup/Identity';
|
||||
|
||||
export const
|
||||
|
||||
// 1 = move, 2 = copy
|
||||
|
@ -28,6 +31,8 @@ dropdownsDetectVisibility = (() =>
|
|||
).debounce(50),
|
||||
|
||||
|
||||
editIdentity = Identity => showScreenPopup(IdentityPopupView, [Identity]),
|
||||
|
||||
loadAccountsAndIdentities = () => {
|
||||
AccountUserStore.loading(true);
|
||||
IdentityUserStore.loading(true);
|
||||
|
@ -49,6 +54,11 @@ loadAccountsAndIdentities = () => {
|
|||
? items.map(identityData => IdentityModel.reviveFromJson(identityData))
|
||||
: []
|
||||
);
|
||||
|
||||
// Invoke "Update Identity" pop up right after login
|
||||
// https://github.com/the-djmaze/snappymail/issues/1689
|
||||
const main = IdentityUserStore.main();
|
||||
main && !main.exists() && setTimeout(()=>editIdentity(main), 1000);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
import { IdentityPopupView } from 'View/Popup/Identity';
|
||||
|
||||
export class IdentityModel extends AbstractModel {
|
||||
/**
|
||||
* @param {string} id
|
||||
|
@ -31,7 +28,9 @@ export class IdentityModel extends AbstractModel {
|
|||
smimeKey: '',
|
||||
smimeCertificate: '',
|
||||
|
||||
askDelete: false
|
||||
askDelete: false,
|
||||
|
||||
exists: false
|
||||
});
|
||||
|
||||
addComputablesTo(this, {
|
||||
|
@ -50,8 +49,4 @@ export class IdentityModel extends AbstractModel {
|
|||
label = this.label();
|
||||
return (name ? `${name} ` : '') + `<${email}>` + (label ? ` (${label})` : '');
|
||||
}
|
||||
|
||||
edit() {
|
||||
showScreenPopup(IdentityPopupView, [this]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
|||
|
||||
//import { koComputable } from 'External/ko';
|
||||
import { SettingsCapa, SettingsGet } from 'Common/Globals';
|
||||
import { loadAccountsAndIdentities } from 'Common/UtilsUser';
|
||||
import { loadAccountsAndIdentities, editIdentity } from 'Common/UtilsUser';
|
||||
|
||||
import { AccountUserStore } from 'Stores/User/Account';
|
||||
import { IdentityUserStore } from 'Stores/User/Identity';
|
||||
|
@ -12,7 +12,6 @@ import Remote from 'Remote/User/Fetch';
|
|||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
||||
import { AccountPopupView } from 'View/Popup/Account';
|
||||
import { IdentityPopupView } from 'View/Popup/Identity';
|
||||
|
||||
export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
|
||||
constructor() {
|
||||
|
@ -44,11 +43,11 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
|
|||
}
|
||||
|
||||
addNewIdentity() {
|
||||
showScreenPopup(IdentityPopupView);
|
||||
editIdentity();
|
||||
}
|
||||
|
||||
editIdentity(identity) {
|
||||
identity.edit();
|
||||
editIdentity(identity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@ import { Settings, SettingsGet } from 'Common/Globals';
|
|||
import { WYSIWYGS } from 'Common/HtmlEditor';
|
||||
import { addSubscribablesTo, addComputablesTo } from 'External/ko';
|
||||
import { i18n, translateTrigger, translatorReload, convertLangName } from 'Common/Translator';
|
||||
import { editIdentity } from 'Common/UtilsUser';
|
||||
|
||||
import { AbstractViewSettings } from 'Knoin/AbstractViews';
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
@ -161,7 +162,7 @@ export class UserSettingsGeneral extends AbstractViewSettings {
|
|||
}
|
||||
|
||||
editMainIdentity() {
|
||||
IdentityUserStore.main()?.edit?.();
|
||||
editIdentity(IdentityUserStore.main());
|
||||
}
|
||||
|
||||
testSoundNotification() {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { koArrayWithDestroy } from 'External/ko';
|
||||
import { koComputable } from 'External/ko';
|
||||
import { koArrayWithDestroy, koComputable } from 'External/ko';
|
||||
import { isArray } from 'Common/Utils';
|
||||
|
||||
export const IdentityUserStore = koArrayWithDestroy();
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import { addObservablesTo, koComputable } from 'External/ko';
|
||||
|
||||
import { getNotification } from 'Common/Translator';
|
||||
import { loadAccountsAndIdentities } from 'Common/UtilsUser';
|
||||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
|
@ -105,7 +104,7 @@ export class IdentityPopupView extends AbstractViewPopup {
|
|||
if (iError) {
|
||||
this.submitError(getNotification(iError));
|
||||
} else {
|
||||
loadAccountsAndIdentities();
|
||||
rl.app.loadAccountsAndIdentities();
|
||||
this.close();
|
||||
}
|
||||
}, data
|
||||
|
|
|
@ -27,6 +27,8 @@ class Identity implements \JsonSerializable
|
|||
private bool $pgpEncrypt = false;
|
||||
private bool $pgpSign = false;
|
||||
|
||||
public bool $exists = true;
|
||||
|
||||
private ?SensitiveString $smimeKey = null;
|
||||
private string $smimeCertificate = '';
|
||||
|
||||
|
@ -155,7 +157,8 @@ class Identity implements \JsonSerializable
|
|||
'pgpEncrypt' => $this->pgpEncrypt,
|
||||
'pgpSign' => $this->pgpSign,
|
||||
'smimeKey' => (string) $this->smimeKey,
|
||||
'smimeCertificate' => $this->smimeCertificate
|
||||
'smimeCertificate' => $this->smimeCertificate,
|
||||
'exists' => $this->exists
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,9 @@ class Identities extends AbstractProvider
|
|||
}));
|
||||
|
||||
// If no primary identity is found, generate default one from account info
|
||||
if ($primaryIdentity === null || $primaryIdentity === false) {
|
||||
$primaryIdentity = $primaryIdentity = new Identity('', $account->Email());
|
||||
if (!$primaryIdentity) {
|
||||
$primaryIdentity = new Identity('', $account->Email());
|
||||
$primaryIdentity->exists = false;
|
||||
$identities[] = $primaryIdentity;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,12 +14,10 @@
|
|||
<label data-i18n="SETTINGS_LABELS/GENERAL" for="tab-identity" role="tab" aria-selected="true" aria-controls="panel1" tabindex="0"></label>
|
||||
<div class="form-horizontal tab-content" role="tabpanel" aria-hidden="false">
|
||||
<div class="control-group">
|
||||
<label data-i18n="POPUPS_IDENTITY/LABEL"></label>
|
||||
<div>
|
||||
<input name="Label" type="text" class="input-xlarge" autofocus=""
|
||||
<label data-i18n="GLOBAL/NAME"></label>
|
||||
<input name="Name" type="text" class="input-xlarge"
|
||||
autocomplete="off" autocorrect="off" autocapitalize="off"
|
||||
data-bind="value: label, hasfocus: $root.labelFocused">
|
||||
</div>
|
||||
data-bind="value: name, hasfocus: $root.nameFocused">
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label data-i18n="GLOBAL/EMAIL"></label>
|
||||
|
@ -31,10 +29,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label data-i18n="GLOBAL/NAME"></label>
|
||||
<input name="Name" type="text" class="input-xlarge"
|
||||
<label data-i18n="POPUPS_IDENTITY/LABEL"></label>
|
||||
<div>
|
||||
<input name="Label" type="text" class="input-xlarge" autofocus=""
|
||||
autocomplete="off" autocorrect="off" autocapitalize="off"
|
||||
data-bind="value: name, hasfocus: $root.nameFocused">
|
||||
data-bind="value: label, hasfocus: $root.labelFocused">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue