snappymail/dev/Model/Identity.js
2024-02-09 02:39:00 +01:00

37 lines
647 B
JavaScript

import { AbstractModel } from 'Knoin/AbstractModel';
import { addObservablesTo } from 'External/ko';
export class IdentityModel extends AbstractModel {
/**
* @param {string} id
* @param {string} email
*/
constructor() {
super();
addObservablesTo(this, {
id: '',
label: '',
email: '',
name: '',
replyTo: '',
bcc: '',
signature: '',
signatureInsertBefore: false,
askDelete: false
});
}
/**
* @returns {string}
*/
formattedName() {
const name = this.name(),
email = this.email(),
label = this.label();
return (name ? `${name} ` : '') + `<${email}>` + (label ? ` (${label})` : '');
}
}