mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 22:47:03 +03:00
Convert user stores to single object instances
Removed unused ContactUserStore.exportingCsv and ContactUserStore.exportingVcf
This commit is contained in:
parent
914c6e8d14
commit
6a454ec624
46 changed files with 671 additions and 710 deletions
|
|
@ -1,36 +1,31 @@
|
|||
import ko from 'ko';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
|
||||
class AccountUserStore {
|
||||
constructor() {
|
||||
ko.addObservablesTo(this, {
|
||||
email: '',
|
||||
parentEmail: '',
|
||||
signature: ''
|
||||
});
|
||||
export const AccountUserStore = {
|
||||
accounts: ko.observableArray(),
|
||||
loading: ko.observable(false).extend({ debounce: 100 }),
|
||||
|
||||
this.accounts = ko.observableArray();
|
||||
this.accounts.loading = ko.observable(false).extend({ debounce: 100 });
|
||||
getEmailAddresses: () => AccountUserStore.accounts.map(item => item ? item.email : null).filter(v => v),
|
||||
|
||||
this.getEmailAddresses = () => this.accounts.map(item => item ? item.email : null).filter(v => v);
|
||||
accountsUnreadCount: ko.computed(() => 0),
|
||||
// accountsUnreadCount: ko.computed(() => {
|
||||
// let result = 0;
|
||||
// AccountUserStore.accounts().forEach(item => {
|
||||
// if (item) {
|
||||
// result += item.count();
|
||||
// }
|
||||
// });
|
||||
// return result;
|
||||
// }),
|
||||
|
||||
this.accountsUnreadCount = ko.computed(() => 0);
|
||||
// this.accountsUnreadCount = ko.computed(() => {
|
||||
// let result = 0;
|
||||
// this.accounts().forEach(item => {
|
||||
// if (item)
|
||||
// {
|
||||
// result += item.count();
|
||||
// }
|
||||
// });
|
||||
// return result;
|
||||
// });
|
||||
populate: () => {
|
||||
AccountUserStore.email(SettingsGet('Email'));
|
||||
AccountUserStore.parentEmail(SettingsGet('ParentEmail'));
|
||||
}
|
||||
};
|
||||
|
||||
populate() {
|
||||
this.email(SettingsGet('Email'));
|
||||
this.parentEmail(SettingsGet('ParentEmail'));
|
||||
}
|
||||
}
|
||||
|
||||
export default new AccountUserStore();
|
||||
ko.addObservablesTo(AccountUserStore, {
|
||||
email: '',
|
||||
parentEmail: '',
|
||||
signature: ''
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue