fix: missing userPrimaryEmail in workflows (#13875)
* fix: missing userPrimaryEmail in workflows * chore * fix: type err
This commit is contained in:
@@ -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 }
|
||||
)
|
||||
|
||||
@@ -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<PartialWorkflowRemin
|
||||
endTime: true,
|
||||
location: true,
|
||||
description: true,
|
||||
userPrimaryEmail: true,
|
||||
user: {
|
||||
select: {
|
||||
email: true,
|
||||
|
||||
Reference in New Issue
Block a user