snappymail/dev/Model/Account.js

31 lines
573 B
JavaScript
Raw Normal View History

2019-07-05 03:19:24 +08:00
import { change } from 'Common/Links';
2016-07-07 05:03:30 +08:00
2019-07-05 03:19:24 +08:00
import { AbstractModel } from 'Knoin/AbstractModel';
2016-07-07 05:03:30 +08:00
2021-01-22 23:32:08 +08:00
export class AccountModel extends AbstractModel {
2016-07-07 05:03:30 +08:00
/**
* @param {string} email
* @param {boolean=} canBeDelete = true
* @param {number=} count = 0
*/
2019-07-05 03:19:24 +08:00
constructor(email, canBeDelete = true, count = 0) {
2020-10-19 01:19:45 +08:00
super();
2016-07-07 05:03:30 +08:00
this.email = email;
2020-10-25 18:46:58 +08:00
this.addObservables({
count: count,
deleteAccess: false,
canBeDeleted: !!canBeDelete
});
2016-07-07 05:03:30 +08:00
this.canBeEdit = this.canBeDeleted;
}
/**
* @returns {string}
*/
changeAccountLink() {
return change(this.email);
}
}