From 86c379817e43791278a9e14f5ea1d9f2ca2bd259 Mon Sep 17 00:00:00 2001 From: Anwar Sadath <37188392+asadath1395@users.noreply.github.com> Date: Tue, 27 Feb 2024 21:20:40 +0530 Subject: [PATCH] fix: Fix calendar event included in the workflow, doesn't show the meeting link (#13872) * Fix calendar event included in the workflow, doesn't show the meeting link * Fix type error * fix public video call url --------- Co-authored-by: CarinaWolli --- packages/features/bookings/lib/handleNewBooking.ts | 3 +-- .../ee/workflows/lib/reminders/emailReminderManager.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts index a19eecfb7b..222dcd9bd0 100644 --- a/packages/features/bookings/lib/handleNewBooking.ts +++ b/packages/features/bookings/lib/handleNewBooking.ts @@ -2291,8 +2291,7 @@ async function handler( loggerWithEventDetails.error("Error while creating booking references", JSON.stringify({ error })); } - const metadataFromEvent = videoCallUrl ? { videoCallUrl } : undefined; - const evtWithMetadata = { ...evt, metadata: metadataFromEvent, eventType: { slug: eventType.slug } }; + const evtWithMetadata = { ...evt, metadata, eventType: { slug: eventType.slug } }; await scheduleMandatoryReminder( evtWithMetadata, diff --git a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts index e45cdaa920..6b70ba1da8 100644 --- a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts +++ b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts @@ -5,6 +5,7 @@ import type { DateArray } from "ics"; import { RRule } from "rrule"; import { v4 as uuidv4 } from "uuid"; +import { guessEventLocationType } from "@calcom/app-store/locations"; import dayjs from "@calcom/dayjs"; import { preprocessNameFieldDataWithVariant } from "@calcom/features/form-builder/utils"; import logger from "@calcom/lib/logger"; @@ -33,6 +34,12 @@ function getiCalEventAsString(evt: BookingInfo, status?: ParticipationStatus) { recurrenceRule = new RRule(evt.eventType.recurringEvent).toString().replace("RRULE:", ""); } + let location = bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl; + + if (!location) { + location = guessEventLocationType(location)?.label || evt.location || ""; + } + const icsEvent = createEvent({ uid, startInputType: "utc", @@ -44,7 +51,7 @@ function getiCalEventAsString(evt: BookingInfo, status?: ParticipationStatus) { duration: { minutes: dayjs(evt.endTime).diff(dayjs(evt.startTime), "minute") }, title: evt.title, description: evt.additionalNotes || "", - location: evt.location || "", + location, organizer: { email: evt.organizer.email || "", name: evt.organizer.name }, attendees: [ {