mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-05 22:42:25 +08:00
42 lines
886 B
JavaScript
42 lines
886 B
JavaScript
import ko from 'ko';
|
|
|
|
class AccountUserStore {
|
|
constructor() {
|
|
ko.addObservablesTo(this, {
|
|
email: '',
|
|
parentEmail: '',
|
|
signature: ''
|
|
});
|
|
|
|
this.accounts = ko.observableArray([]);
|
|
this.accounts.loading = ko.observable(false).extend({ throttle: 100 });
|
|
|
|
this.getEmailAddresses = () => this.accounts().map(item => item ? item.email : null).filter(v => v);
|
|
|
|
this.accountsUnreadCount = ko.computed(() => 0);
|
|
// this.accountsUnreadCount = ko.computed(() => {
|
|
// let result = 0;
|
|
// this.accounts().forEach(item => {
|
|
// if (item)
|
|
// {
|
|
// result += item.count();
|
|
// }
|
|
// });
|
|
// return result;
|
|
// });
|
|
}
|
|
|
|
populate() {
|
|
this.email(rl.settings.get('Email'));
|
|
this.parentEmail(rl.settings.get('ParentEmail'));
|
|
}
|
|
|
|
/**
|
|
* @returns {boolean}
|
|
*/
|
|
isRootAccount() {
|
|
return !this.parentEmail();
|
|
}
|
|
}
|
|
|
|
export default new AccountUserStore();
|