mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-11 01:23:43 +08:00
39 lines
647 B
JavaScript
39 lines
647 B
JavaScript
import { koComputable } from 'External/ko';
|
|
|
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
|
|
|
export class IdentityModel extends AbstractModel {
|
|
/**
|
|
* @param {string} id
|
|
* @param {string} email
|
|
*/
|
|
constructor(id, email) {
|
|
super();
|
|
|
|
this.addObservables({
|
|
id: id || '',
|
|
email: email,
|
|
name: '',
|
|
|
|
replyTo: '',
|
|
bcc: '',
|
|
|
|
signature: '',
|
|
signatureInsertBefore: false,
|
|
|
|
askDelete: false
|
|
});
|
|
|
|
this.canBeDeleted = koComputable(() => !!this.id());
|
|
}
|
|
|
|
/**
|
|
* @returns {string}
|
|
*/
|
|
formattedName() {
|
|
const name = this.name(),
|
|
email = this.email();
|
|
|
|
return name ? name + ' <' + email + '>' : email;
|
|
}
|
|
}
|