From 1d27e25ea3a86ec1fb09574b425d4a7ea9228a1c Mon Sep 17 00:00:00 2001 From: Morgan Ludtke <42942267+ludtkemorgan@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:28:29 -0600 Subject: [PATCH] fix: only send listing approval email once (#3731) --- backend/core/src/listings/listings.service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/core/src/listings/listings.service.ts b/backend/core/src/listings/listings.service.ts index d717da6005..f783e35921 100644 --- a/backend/core/src/listings/listings.service.ts +++ b/backend/core/src/listings/listings.service.ts @@ -316,7 +316,10 @@ export class ListingsService { const nonApprovingRoles = [UserRoleEnum.partner] if (!params.approvingRoles.includes(UserRoleEnum.jurisdictionAdmin)) nonApprovingRoles.push(UserRoleEnum.jurisdictionAdmin) - if (params.status === ListingStatus.pendingReview) { + if ( + params.status === ListingStatus.pendingReview && + params.previousStatus !== ListingStatus.pendingReview + ) { const userInfo = await this.getUserEmailInfo( params.approvingRoles, params.listingInfo.id, @@ -330,7 +333,10 @@ export class ListingsService { ) } // admin updates status to changes requested when approval requires partner changes - else if (params.status === ListingStatus.changesRequested) { + else if ( + params.status === ListingStatus.changesRequested && + params.previousStatus !== ListingStatus.changesRequested + ) { const userInfo = await this.getUserEmailInfo( nonApprovingRoles, params.listingInfo.id,