chore: Add location to workflow reminder template (#17449)

* chore: Add location to workflow reminder template

* update

* remove log
This commit is contained in:
Anik Dhabal Babu
2024-12-09 18:58:17 +00:00
committed by GitHub
parent 1680cba5a5
commit 45f8ecbab7
3 changed files with 14 additions and 1 deletions
@@ -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
@@ -192,6 +192,8 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>
endTime,
evt.title,
timeZone,
evt.location || "",
bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl || "",
attendeeName,
name
);
@@ -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 = `<div><strong class="editor-text-bold">Attendees: </strong></div>You & ${otherPerson}<br><br>`;
const locationHtml = `<div><strong class="editor-text-bold">Location: </strong></div>${locationString}<br><br>`;
const branding = !isBrandingDisabled && !isEditingMode ? `<br><br>_<br><br>Scheduling by ${APP_NAME}` : "";
const endingHtml = `This reminder was triggered by a Workflow in Cal.${branding}</body>`;
const emailBody = introHtml + eventHtml + dateTimeHtml + attendeeHtml + endingHtml;
const emailBody = introHtml + eventHtml + dateTimeHtml + attendeeHtml + locationHtml + endingHtml;
return { emailSubject, emailBody };
};