Skip to content

Commit

Permalink
add subdomain support to the email modal (#2429)
Browse files Browse the repository at this point in the history
* add subdomain support to the email modal

* improve subdomain logic

---------

Co-authored-by: Angel Montenegro <[email protected]>
  • Loading branch information
auumgn and amontenegro authored Dec 16, 2024
1 parent 28eb2d7 commit 5d8b837
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 5d8b837

Please sign in to comment.