From 45f8ecbab74f96afa0c84e5b03a5a60ac6e6e2a7 Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:28:17 +0530 Subject: [PATCH] chore: Add location to workflow reminder template (#17449) * chore: Add location to workflow reminder template * update * remove log --- .../features/ee/workflows/api/scheduleEmailReminders.ts | 4 ++++ .../ee/workflows/lib/reminders/emailReminderManager.ts | 2 ++ .../lib/reminders/templates/emailReminderTemplate.ts | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/features/ee/workflows/api/scheduleEmailReminders.ts b/packages/features/ee/workflows/api/scheduleEmailReminders.ts index 2f5e6bc0ba..4e1cae4b7f 100644 --- a/packages/features/ee/workflows/api/scheduleEmailReminders.ts +++ b/packages/features/ee/workflows/api/scheduleEmailReminders.ts @@ -247,6 +247,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { reminder.booking.endTime.toISOString() || "", reminder.booking.eventType?.title || "", timeZone || "", + reminder.booking.location || "", + bookingMetadataSchema.parse(reminder.booking.metadata || {})?.videoCallUrl || "", attendeeName || "", name || "", !!reminder.booking.user?.hideBranding @@ -375,6 +377,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { reminder.booking.endTime.toISOString() || "", reminder.booking.eventType?.title || "", timeZone || "", + reminder.booking.location || "", + bookingMetadataSchema.parse(reminder.booking.metadata || {})?.videoCallUrl || "", attendeeName || "", name || "", !!reminder.booking.user?.hideBranding diff --git a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts index 71265e7347..6ca689aab7 100644 --- a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts +++ b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts @@ -192,6 +192,8 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) => endTime, evt.title, timeZone, + evt.location || "", + bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl || "", attendeeName, name ); diff --git a/packages/features/ee/workflows/lib/reminders/templates/emailReminderTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/emailReminderTemplate.ts index e9862da5b3..5cd183fae0 100644 --- a/packages/features/ee/workflows/lib/reminders/templates/emailReminderTemplate.ts +++ b/packages/features/ee/workflows/lib/reminders/templates/emailReminderTemplate.ts @@ -1,3 +1,4 @@ +import { guessEventLocationType } from "@calcom/app-store/locations"; import dayjs from "@calcom/dayjs"; import { APP_NAME } from "@calcom/lib/constants"; import { TimeFormat } from "@calcom/lib/timeFormat"; @@ -12,6 +13,8 @@ const emailReminderTemplate = ( endTime?: string, eventName?: string, timeZone?: string, + location?: string, + meetingUrl?: string, otherPerson?: string, name?: string, isBrandingDisabled?: boolean @@ -20,11 +23,13 @@ const emailReminderTemplate = ( const dateTimeFormat = `ddd, MMM D, YYYY ${currentTimeFormat}`; let eventDate = ""; + let locationString = `${guessEventLocationType(location)?.label || location} ${meetingUrl}`; if (isEditingMode) { endTime = "{EVENT_END_TIME}"; eventName = "{EVENT_NAME}"; timeZone = "{TIMEZONE}"; + locationString = "{LOCATION} {MEETING_URL}"; otherPerson = action === WorkflowActions.EMAIL_ATTENDEE ? "{ORGANIZER}" : "{ATTENDEE}"; name = action === WorkflowActions.EMAIL_ATTENDEE ? "{ATTENDEE}" : "{ORGANIZER}"; eventDate = `{EVENT_DATE_${dateTimeFormat}}`; @@ -46,11 +51,13 @@ const emailReminderTemplate = ( const attendeeHtml = `
Attendees:
You & ${otherPerson}

`; + const locationHtml = `
Location:
${locationString}

`; + const branding = !isBrandingDisabled && !isEditingMode ? `

_

Scheduling by ${APP_NAME}` : ""; const endingHtml = `This reminder was triggered by a Workflow in Cal.${branding}`; - const emailBody = introHtml + eventHtml + dateTimeHtml + attendeeHtml + endingHtml; + const emailBody = introHtml + eventHtml + dateTimeHtml + attendeeHtml + locationHtml + endingHtml; return { emailSubject, emailBody }; };