From 974acaab90051986ae88e677b9038119e7cd0fa2 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 13 Feb 2023 17:05:44 +0100 Subject: [PATCH] Cleanup EmailModel --- dev/Model/Email.js | 21 ++------------------- dev/View/Popup/Contacts.js | 2 +- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/dev/Model/Email.js b/dev/Model/Email.js index 0dcfec88a..8b189407b 100644 --- a/dev/Model/Email.js +++ b/dev/Model/Email.js @@ -220,22 +220,13 @@ export class EmailModel extends AbstractModel { static reviveFromJson(json) { const email = super.reviveFromJson(json); email?.cleanup(); - return email?.validate() ? email : null; - } - - /** - * @returns {void} - */ - clear() { - this.email = ''; - this.name = ''; - this.dkimStatus = 'none'; + return email?.valid() ? email : null; } /** * @returns {boolean} */ - validate() { + valid() { 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} wrapWithLink = false diff --git a/dev/View/Popup/Contacts.js b/dev/View/Popup/Contacts.js index 27d55fb22..a3f667e45 100644 --- a/dev/View/Popup/Contacts.js +++ b/dev/View/Popup/Contacts.js @@ -140,7 +140,7 @@ export class ContactsPopupView extends AbstractViewPopup { this.contactsCheckedOrSelected().forEach(oContact => { const data = oContact?.getNameAndEmailHelper(), email = data ? new EmailModel(data[0], data[1]) : null; - email?.validate() && aE.push(email); + email?.valid() && aE.push(email); }); if (arrayLength(aE)) {