From 1e0ce30a07875c496bf4c07285ff0fef761c81cb Mon Sep 17 00:00:00 2001 From: Eric McGarry <46828798+mcgarrye@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:46:52 -0500 Subject: [PATCH] chore: remove unused email logic (#4526) * chore: remove unused email logic 4517 * chore: fold in getMismatchedJurisdictions 4517 --- api/src/services/email.service.ts | 23 ------------ api/src/services/user.service.ts | 49 +++++-------------------- api/src/views/portal-account-update.hbs | 11 ------ 3 files changed, 10 insertions(+), 73 deletions(-) delete mode 100644 api/src/views/portal-account-update.hbs diff --git a/api/src/services/email.service.ts b/api/src/services/email.service.ts index 46e85ff113..e852a0d643 100644 --- a/api/src/services/email.service.ts +++ b/api/src/services/email.service.ts @@ -237,29 +237,6 @@ export class EmailService { ); } - /* send account update email */ - async portalAccountUpdate( - jurisdictionIds: IdDTO[], - user: User, - appUrl: string, - ) { - const jurisdiction = await this.getJurisdiction(jurisdictionIds); - void (await this.loadTranslations(jurisdiction, user.language)); - const emailFromAddress = await this.getEmailToSendFrom( - jurisdictionIds, - jurisdiction, - ); - await this.send( - user.email, - emailFromAddress, - this.polyglot.t('invite.portalAccountUpdate'), - this.template('portal-account-update')({ - user, - appUrl, - }), - ); - } - /* send change of email email */ public async changeEmail( jurisdictionName: string, diff --git a/api/src/services/user.service.ts b/api/src/services/user.service.ts index c737c06faf..db6835a66f 100644 --- a/api/src/services/user.service.ts +++ b/api/src/services/user.service.ts @@ -717,25 +717,6 @@ export class UserService { confirmationUrl, ); } - - // Partner user that is given access to an additional jurisdiction - } else if ( - forPartners && - existingUser && - 'userRoles' in dto && - existingUser?.userRoles?.isPartner && - dto?.userRoles?.isPartner && - this.jurisdictionMismatch(dto.jurisdictions, existingUser.jurisdictions) - ) { - const newJurisdictions = this.getMismatchedJurisdictions( - dto.jurisdictions, - existingUser.jurisdictions, - ); - this.emailService.portalAccountUpdate( - newJurisdictions, - mapTo(User, newUser), - dto.appUrl, - ); } else if (forPartners) { const confirmationUrl = this.getPartnersConfirmationUrl( this.configService.get('PARTNERS_PORTAL_URL'), @@ -896,29 +877,19 @@ export class UserService { existingJurisdictions: IdDTO[], ): boolean { return ( - this.getMismatchedJurisdictions( - incomingJurisdictions, - existingJurisdictions, - ).length > 0 + incomingJurisdictions.reduce((misMatched, jurisdiction) => { + if ( + !existingJurisdictions?.some( + (existingJuris) => existingJuris.id === jurisdiction.id, + ) + ) { + misMatched.push(jurisdiction.id); + } + return misMatched; + }, []).length > 0 ); } - getMismatchedJurisdictions( - incomingJurisdictions: IdDTO[], - existingJurisdictions: IdDTO[], - ) { - return incomingJurisdictions.reduce((misMatched, jurisdiction) => { - if ( - !existingJurisdictions?.some( - (existingJuris) => existingJuris.id === jurisdiction.id, - ) - ) { - misMatched.push(jurisdiction.id); - } - return misMatched; - }, []); - } - containsInvalidCharacters(value: string): boolean { return value.includes('.') || value.includes('http'); } diff --git a/api/src/views/portal-account-update.hbs b/api/src/views/portal-account-update.hbs deleted file mode 100644 index a046a1c28e..0000000000 --- a/api/src/views/portal-account-update.hbs +++ /dev/null @@ -1,11 +0,0 @@ -
- {{t "invite.userUpdateNewListings"}} -
-{{appUrl}} -