diff --git a/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts b/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts index f493844a05..80a6465209 100644 --- a/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts +++ b/services/apps/alcs/src/portal/application-submission/application-submission.controller.spec.ts @@ -610,56 +610,6 @@ describe('ApplicationSubmissionController', () => { }); }); - it('should only send status email for first time non-TUR applications', async () => { - const mockFileId = 'file-id'; - mockAppSubmissionService.submitToLg.mockResolvedValue( - new ApplicationSubmissionToSubmissionStatus(), - ); - const mockOwner = new ApplicationOwner({ uuid: primaryContactOwnerUuid }); - const mockApplicationSubmission = new ApplicationSubmission({ - typeCode: 'NOT-TURP', - owners: [mockOwner], - primaryContactOwnerUuid, - localGovernmentUuid, - submissionStatuses: [ - new ApplicationSubmissionToSubmissionStatus({ - statusTypeCode: SUBMISSION_STATUS.INCOMPLETE, - submissionUuid: 'fake', - effectiveDate: new Date(), - }), - ], - }); - mockAppSubmissionService.verifyAccessByUuid.mockResolvedValue( - mockApplicationSubmission, - ); - mockAppValidationService.validateSubmission.mockResolvedValue({ - submission: mockApplicationSubmission as ValidatedApplicationSubmission, - errors: [], - }); - mockStatusEmailService.sendApplicationStatusEmail.mockResolvedValue(); - - const mockGovernment = new LocalGovernment({ uuid: localGovernmentUuid }); - mockStatusEmailService.getApplicationEmailData.mockResolvedValue({ - applicationSubmission: mockApplicationSubmission, - primaryContact: mockOwner, - submissionGovernment: mockGovernment, - }); - - await controller.submitAsApplicant(mockFileId, { - user: { - entity: new User(), - }, - }); - - expect(mockAppSubmissionService.verifyAccessByUuid).toHaveBeenCalledTimes( - 1, - ); - expect(mockAppSubmissionService.submitToLg).toHaveBeenCalledTimes(1); - expect( - mockStatusEmailService.sendApplicationStatusEmail, - ).toHaveBeenCalledTimes(0); - }); - it('should throw an exception if application fails validation', async () => { const mockFileId = 'file-id'; const mockApplicationSubmission = new ApplicationSubmission({ diff --git a/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts b/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts index dc317ddb00..ecd7d0a4b4 100644 --- a/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts +++ b/services/apps/alcs/src/portal/application-submission/application-submission.controller.ts @@ -16,8 +16,8 @@ import { } from '../../../../../libs/common/src/exceptions/base.exception'; import { generateCANCApplicationHtml } from '../../../../../templates/emails/cancelled'; import { - generateSUBGTurApplicantHtml, generateSUBGNoReviewGovernmentTemplateEmail, + generateSUBGTurApplicantHtml, } from '../../../../../templates/emails/submitted-to-alc'; import { generateSUBGCoveApplicantHtml } from '../../../../../templates/emails/submitted-to-alc/cove-applicant.template'; import { @@ -288,39 +288,25 @@ export class ApplicationSubmissionController { ); if (matchingType.requiresGovernmentReview) { - const wasSubmittedToLfng = validatedSubmission.submissionStatuses.find( - (s) => - [ - SUBMISSION_STATUS.SUBMITTED_TO_LG, - SUBMISSION_STATUS.IN_REVIEW_BY_LG, - SUBMISSION_STATUS.WRONG_GOV, - SUBMISSION_STATUS.INCOMPLETE, - ].includes(s.statusTypeCode as SUBMISSION_STATUS) && - !!s.effectiveDate, - ); - - // Send status emails for first time submissions - if (!wasSubmittedToLfng) { - if (primaryContact) { - await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateSUBGApplicantHtml, - status: SUBMISSION_STATUS.SUBMITTED_TO_LG, - applicationSubmission: validatedSubmission, - government: submissionGovernment, - parentType: PARENT_TYPE.APPLICATION, - primaryContact, - }); - } + if (primaryContact) { + await this.statusEmailService.sendApplicationStatusEmail({ + generateStatusHtml: generateSUBGApplicantHtml, + status: SUBMISSION_STATUS.SUBMITTED_TO_LG, + applicationSubmission: validatedSubmission, + government: submissionGovernment, + parentType: PARENT_TYPE.APPLICATION, + primaryContact, + }); + } - if (submissionGovernment) { - await this.statusEmailService.sendApplicationStatusEmail({ - generateStatusHtml: generateSUBGGovernmentHtml, - status: SUBMISSION_STATUS.SUBMITTED_TO_LG, - applicationSubmission: validatedSubmission, - government: submissionGovernment, - parentType: PARENT_TYPE.APPLICATION, - }); - } + if (submissionGovernment) { + await this.statusEmailService.sendApplicationStatusEmail({ + generateStatusHtml: generateSUBGGovernmentHtml, + status: SUBMISSION_STATUS.SUBMITTED_TO_LG, + applicationSubmission: validatedSubmission, + government: submissionGovernment, + parentType: PARENT_TYPE.APPLICATION, + }); } return await this.applicationSubmissionService.submitToLg(