mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Cleanup EmailModel
This commit is contained in:
parent
ceac15ace9
commit
974acaab90
2 changed files with 3 additions and 20 deletions
|
|
@ -220,22 +220,13 @@ export class EmailModel extends AbstractModel {
|
||||||
static reviveFromJson(json) {
|
static reviveFromJson(json) {
|
||||||
const email = super.reviveFromJson(json);
|
const email = super.reviveFromJson(json);
|
||||||
email?.cleanup();
|
email?.cleanup();
|
||||||
return email?.validate() ? email : null;
|
return email?.valid() ? email : null;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
clear() {
|
|
||||||
this.email = '';
|
|
||||||
this.name = '';
|
|
||||||
this.dkimStatus = 'none';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
validate() {
|
valid() {
|
||||||
return this.name || this.email;
|
return this.name || this.email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,14 +239,6 @@ export class EmailModel extends AbstractModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} query
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
search(query) {
|
|
||||||
return (this.name + ' ' + this.email).toLowerCase().includes(query.toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} friendlyView = false
|
* @param {boolean} friendlyView = false
|
||||||
* @param {boolean} wrapWithLink = false
|
* @param {boolean} wrapWithLink = false
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ export class ContactsPopupView extends AbstractViewPopup {
|
||||||
this.contactsCheckedOrSelected().forEach(oContact => {
|
this.contactsCheckedOrSelected().forEach(oContact => {
|
||||||
const data = oContact?.getNameAndEmailHelper(),
|
const data = oContact?.getNameAndEmailHelper(),
|
||||||
email = data ? new EmailModel(data[0], data[1]) : null;
|
email = data ? new EmailModel(data[0], data[1]) : null;
|
||||||
email?.validate() && aE.push(email);
|
email?.valid() && aE.push(email);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (arrayLength(aE)) {
|
if (arrayLength(aE)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue