Skip to content

Commit b623722

Browse files
committed
revert: send separate notification emails
1 parent 32ce204 commit b623722

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

packages/backend/src/apps/postman/__tests__/actions/send-transactional-email.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,6 @@ describe('send transactional email', () => {
686686
userEmail: $.user.email,
687687
executionId: $.execution.id,
688688
blacklistedRecipients: [recipients[1]],
689-
invalidAttachmentBody: expect.any(String),
690689
})
691690
})
692691
})

packages/backend/src/apps/postman/actions/send-transactional-email/index.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ import {
1818
getDefaultReplyTo,
1919
} from '../../common/parameters-helper'
2020
import { sendBlacklistEmail } from '../../common/send-blacklist-email'
21-
import {
22-
createInvalidAttachmentsMessage,
23-
sendInvalidAttachmentsEmail,
24-
} from '../../common/send-invalid-attachments-email'
21+
import { sendInvalidAttachmentsEmail } from '../../common/send-invalid-attachments-email'
2522
import { throwPostmanStepError } from '../../common/throw-errors'
2623

2724
const action: IRawAction = {
@@ -182,17 +179,9 @@ const action: IRawAction = {
182179
*/
183180
if (blacklistedRecipients.length > 0 && !$.execution.testRun) {
184181
try {
185-
let invalidAttachmentBody = null
186-
if (hasInvalidAttachments) {
187-
invalidAttachmentBody = createInvalidAttachmentsMessage({
188-
...defaultSendEmailParams,
189-
...invalidAttachmentParams,
190-
})
191-
}
192182
await sendBlacklistEmail({
193183
...defaultSendEmailParams,
194184
blacklistedRecipients,
195-
...(invalidAttachmentBody && { invalidAttachmentBody }),
196185
})
197186
} catch (e) {
198187
logger.error(e)
@@ -207,15 +196,10 @@ const action: IRawAction = {
207196
}
208197

209198
/**
210-
* Send invalid attachments notification email if no blacklisted recipients
199+
* Send invalid attachments notification email
211200
* Do not send on partial retry as we would have already sent this once with the blacklist email
212201
*/
213-
if (
214-
hasInvalidAttachments &&
215-
!isPartialRetry &&
216-
blacklistedRecipients.length === 0 &&
217-
!$.execution.testRun
218-
) {
202+
if (hasInvalidAttachments && !isPartialRetry && !$.execution.testRun) {
219203
await sendInvalidAttachmentsEmail({
220204
...defaultSendEmailParams,
221205
...invalidAttachmentParams,

packages/backend/src/apps/postman/common/send-blacklist-email.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ interface SendBlacklistEmailProps {
1313
userEmail: string
1414
executionId: string
1515
blacklistedRecipients: string[]
16-
invalidAttachmentBody?: string
1716
}
1817

1918
interface BlacklistEmailProps {
2019
flowName: string
2120
userEmail: string
2221
executionId: string
2322
blacklistedRecipients: string[]
24-
invalidAttachmentBody?: string
2523
}
2624

2725
type BlacklistEmailFormProps = Omit<BlacklistEmailProps, 'flowName'>
@@ -49,11 +47,11 @@ export function createRequestBlacklistFormLink({
4947
}
5048

5149
function createBodyErrorMessage(props: BlacklistEmailProps): string {
52-
const { flowName, blacklistedRecipients, invalidAttachmentBody } = props
50+
const { flowName, blacklistedRecipients } = props
5351

5452
const formLink = createRequestBlacklistFormLink(props)
5553

56-
let bodyMessage = `
54+
const bodyMessage = `
5755
Dear fellow plumber,
5856
<br>
5957
<br>
@@ -73,13 +71,6 @@ function createBodyErrorMessage(props: BlacklistEmailProps): string {
7371
<li>Wait for an email confirmation from us (1-2 working days) for further instructions.</li>
7472
</ol>
7573
<br>
76-
`
77-
78-
if (invalidAttachmentBody) {
79-
bodyMessage += invalidAttachmentBody
80-
}
81-
82-
bodyMessage += `
8374
Regards,
8475
<br>
8576
Plumber team
@@ -127,7 +118,6 @@ export async function sendBlacklistEmail({
127118
userEmail,
128119
executionId,
129120
blacklistedRecipients,
130-
invalidAttachmentBody,
131121
}: SendBlacklistEmailProps) {
132122
const truncatedFlowName = truncateFlowName(flowName)
133123
const filteredBlacklist = await filterNotifiedEmails(
@@ -146,7 +136,6 @@ export async function sendBlacklistEmail({
146136
userEmail,
147137
executionId,
148138
blacklistedRecipients: filteredBlacklist,
149-
invalidAttachmentBody,
150139
}),
151140
recipient: userEmail,
152141
replyTo: '[email protected]',

0 commit comments

Comments
 (0)