From c39a7dba85ca30e992ef71e257c8a07fbfd510cf Mon Sep 17 00:00:00 2001 From: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Date: Fri, 16 Dec 2022 23:58:43 +0100 Subject: [PATCH] don't send scheduled (#6072) Co-authored-by: CarinaWolli --- .../workflows/api/scheduleEmailReminders.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/features/ee/workflows/api/scheduleEmailReminders.ts b/packages/features/ee/workflows/api/scheduleEmailReminders.ts index 68003ddf19..3bce1c061b 100644 --- a/packages/features/ee/workflows/api/scheduleEmailReminders.ts +++ b/packages/features/ee/workflows/api/scheduleEmailReminders.ts @@ -147,16 +147,18 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { const batchId = batchIdResponse[1].batch_id; - await sgMail.send({ - to: sendTo, - from: senderEmail, - subject: emailContent.emailSubject, - text: emailContent.emailBody.text, - html: emailContent.emailBody.html, - batchId: batchId, - sendAt: dayjs(reminder.scheduledDate).unix(), - replyTo: reminder.booking?.user?.email || senderEmail, - }); + if (reminder.workflowStep.action !== WorkflowActions.EMAIL_ADDRESS) { + await sgMail.send({ + to: sendTo, + from: senderEmail, + subject: emailContent.emailSubject, + text: emailContent.emailBody.text, + html: emailContent.emailBody.html, + batchId: batchId, + sendAt: dayjs(reminder.scheduledDate).unix(), + replyTo: reminder.booking?.user?.email || senderEmail, + }); + } await prisma.workflowReminder.update({ where: {