From d950a9cbc49316879c752ed510ad9dea27de095f Mon Sep 17 00:00:00 2001 From: Hariom Date: Sat, 28 Oct 2023 19:37:50 +0530 Subject: [PATCH] fix: request reschedule link in for an Org event --- packages/core/builders/CalendarEvent/builder.ts | 5 ++++- packages/core/builders/CalendarEvent/class.ts | 1 + .../routers/viewer/bookings/requestReschedule.handler.ts | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/builders/CalendarEvent/builder.ts b/packages/core/builders/CalendarEvent/builder.ts index 80a75ba2b1..c3e0e75012 100644 --- a/packages/core/builders/CalendarEvent/builder.ts +++ b/packages/core/builders/CalendarEvent/builder.ts @@ -255,7 +255,10 @@ export class CalendarEventBuilder implements ICalendarEventBuilder { const queryParams = new URLSearchParams(); queryParams.set("rescheduleUid", `${booking.uid}`); slug = `${slug}`; - const rescheduleLink = `${WEBAPP_URL}/${slug}?${queryParams.toString()}`; + + const rescheduleLink = `${ + this.calendarEvent.bookerUrl ?? WEBAPP_URL + }/${slug}?${queryParams.toString()}`; this.rescheduleLink = rescheduleLink; } catch (error) { if (error instanceof Error) { diff --git a/packages/core/builders/CalendarEvent/class.ts b/packages/core/builders/CalendarEvent/class.ts index 2f069c3425..2b33d7223d 100644 --- a/packages/core/builders/CalendarEvent/class.ts +++ b/packages/core/builders/CalendarEvent/class.ts @@ -9,6 +9,7 @@ import type { } from "@calcom/types/Calendar"; class CalendarEventClass implements CalendarEvent { + bookerUrl?: string | undefined; type!: string; title!: string; startTime!: string; diff --git a/packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts b/packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts index ca282c9d4c..21458ef291 100644 --- a/packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts +++ b/packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts @@ -17,6 +17,7 @@ import sendPayload from "@calcom/features/webhooks/lib/sendPayload"; import { isPrismaObjOrUndefined } from "@calcom/lib"; import { getTeamIdFromEventType } from "@calcom/lib/getTeamIdFromEventType"; import { getTranslation } from "@calcom/lib/server"; +import { getBookerUrl } from "@calcom/lib/server/getBookerUrl"; import { getUsersCredentials } from "@calcom/lib/server/getUsersCredentials"; import { prisma } from "@calcom/prisma"; import type { WebhookTriggerEvents } from "@calcom/prisma/enums"; @@ -167,6 +168,7 @@ export const requestRescheduleHandler = async ({ ctx, input }: RequestReschedule const builder = new CalendarEventBuilder(); builder.init({ title: bookingToReschedule.title, + bookerUrl: await getBookerUrl(user), type: event && event.title ? event.title : bookingToReschedule.title, startTime: bookingToReschedule.startTime.toISOString(), endTime: bookingToReschedule.endTime.toISOString(),