From 5d8b8379cede86f9d5e1a821ea3e0be903f15c99 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:57:40 +0200 Subject: [PATCH] add subdomain support to the email modal (#2429) * add subdomain support to the email modal * improve subdomain logic --------- Co-authored-by: Angel Montenegro --- .../modals/modal-email/modal-email.component.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts index 0c52a8236..95bcfe7a8 100644 --- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts +++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts @@ -486,7 +486,11 @@ export class ModalEmailComponent implements OnInit, OnDestroy { if (domain) { const remainingEmailsHaveDomain = this.emails.find((email) => - email ? email.verified && email.value.split('@')[1] === domain : false + email + ? email.verified && + (email.value.split('@')[1].endsWith('.' + domain) || + email.value.split('@')[1] === domain) + : false ) if (!remainingEmailsHaveDomain) { this.verifiedDomains = this.verifiedDomains.filter( @@ -579,7 +583,10 @@ export class ModalEmailComponent implements OnInit, OnDestroy { if (controlKey.startsWith('emailInput')) { const control = this.emailsForm.get(controlKey).value - if (control.email.split('@')[1] === domain) { + if ( + control.email.split('@')[1].endsWith('.' + domain) || + control.email.split('@')[1] === domain + ) { visibilities.push(control.visibility) } } @@ -612,7 +619,10 @@ export class ModalEmailComponent implements OnInit, OnDestroy { Object.keys(this.emailsForm.controls).forEach((controlKey) => { if (controlKey.startsWith('emailInput')) { const control = this.emailsForm.get(controlKey) - if (control.value.email.split('@')[1] === domain) { + if ( + control.value.email.split('@')[1].endsWith('.' + domain) || + control.value.email.split('@')[1] === domain + ) { if (this.isEmailVerified(control.value.email)) { visibilities.push(control.value.visibility) }