Scheduling infrastructure for absolutely everyone.
fix: missing userPrimaryEmail in workflows (#13875)
Udit Takkar80080dda7aff
diff --git a/packages/features/ee/workflows/api/scheduleEmailReminders.ts b/packages/features/ee/workflows/api/scheduleEmailReminders.tsindex 0c48d8ff27c..7f862e14a17 100644--- a/packages/features/ee/workflows/api/scheduleEmailReminders.ts+++ b/packages/features/ee/workflows/api/scheduleEmailReminders.ts@@ -116,7 +116,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {switch (reminder.workflowStep.action) {case WorkflowActions.EMAIL_HOST:- sendTo = reminder.booking.user?.email;+ sendTo = reminder.booking?.userPrimaryEmail ?? reminder.booking.user?.email;break;case WorkflowActions.EMAIL_ATTENDEE:sendTo = reminder.booking.attendees[0].email;@@ -227,7 +227,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {html: emailContent.emailBody,batchId: batchId,sendAt: dayjs(reminder.scheduledDate).unix(),- replyTo: reminder.booking.user?.email,+ replyTo: reminder.booking?.userPrimaryEmail ?? reminder.booking.user?.email,attachments: reminder.workflowStep.includeCalendarEvent? [{@@ -297,7 +297,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {html: emailContent.emailBody,batchId: batchId,sendAt: dayjs(reminder.scheduledDate).unix(),- replyTo: reminder.booking.user?.email,+ replyTo: reminder.booking?.userPrimaryEmail ?? reminder.booking.user?.email,},{ sender: reminder.workflowStep?.sender })diff --git a/packages/features/ee/workflows/lib/getWorkflowReminders.ts b/packages/features/ee/workflows/lib/getWorkflowReminders.tsindex e251397aa48..b459a89bb45 100644--- a/packages/features/ee/workflows/lib/getWorkflowReminders.ts+++ b/packages/features/ee/workflows/lib/getWorkflowReminders.ts@@ -23,6 +23,7 @@ type PartialBooking =| "responses"| "uid"| "attendees"+ | "userPrimaryEmail"> & { eventType: Partial<EventType> | null } & { user: Partial<User> | null })| null;@@ -134,6 +135,7 @@ export async function getAllUnscheduledReminders(): Promise<PartialWorkflowReminendTime: true,location: true,description: true,+ userPrimaryEmail: true,user: {select: {email: true,