2020-09-16 22:33:53 +08:00
|
|
|
import { AbstractCollectionModel } from 'Model/AbstractCollection';
|
2020-09-15 15:43:53 +08:00
|
|
|
import { EmailModel } from 'Model/Email';
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2020-09-16 22:33:53 +08:00
|
|
|
export class EmailCollectionModel extends AbstractCollectionModel
|
2020-09-15 15:43:53 +08:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param {?Array} json
|
2020-09-15 21:08:08 +08:00
|
|
|
* @returns {EmailCollectionModel}
|
2020-09-15 15:43:53 +08:00
|
|
|
*/
|
|
|
|
static reviveFromJson(items) {
|
2020-10-23 21:15:54 +08:00
|
|
|
return super.reviveFromJson(items, email => EmailModel.reviveFromJson(email));
|
2020-09-15 15:43:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {boolean=} friendlyView = false
|
|
|
|
* @param {boolean=} wrapWithLink = false
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
toString(friendlyView = false, wrapWithLink = false) {
|
|
|
|
const result = [];
|
|
|
|
this.forEach(email => result.push(email.toLine(friendlyView, wrapWithLink)));
|
|
|
|
return result.join(', ');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
toStringClear() {
|
|
|
|
const result = [];
|
|
|
|
this.forEach(email => {
|
|
|
|
if (email && email.email && email.name) {
|
|
|
|
result.push(email.email);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return result.join(', ');
|
|
|
|
}
|
|
|
|
}
|