Skip to content

Commit

Permalink
chore: remove unused email logic (bloom-housing#4526)
Browse files Browse the repository at this point in the history
* chore: remove unused email logic

4517

* chore: fold in getMismatchedJurisdictions

4517
  • Loading branch information
mcgarrye committed Jan 8, 2025
1 parent af63e3d commit 1e0ce30
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 73 deletions.
23 changes: 0 additions & 23 deletions api/src/services/email.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
49 changes: 10 additions & 39 deletions api/src/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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');
}
Expand Down
11 changes: 0 additions & 11 deletions api/src/views/portal-account-update.hbs

This file was deleted.

0 comments on commit 1e0ce30

Please sign in to comment.