From 90939090750a59932c7ca9d3837db3197977d46d Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Fri, 3 Feb 2023 15:50:10 +0530 Subject: [PATCH] Hotfix: Event Name (#6863) (#6864) --- apps/web/pages/booking/[uid].tsx | 2 +- packages/core/event.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsx index c7463a7577..8fee2fd5df 100644 --- a/apps/web/pages/booking/[uid].tsx +++ b/apps/web/pages/booking/[uid].tsx @@ -240,7 +240,7 @@ export default function Success(props: SuccessProps) { const giphyAppData = getEventTypeAppData(eventType, "giphy"); const giphyImage = giphyAppData?.thankYouPage; - const eventName = getEventName(eventNameObject); + const eventName = getEventName(eventNameObject, true); const needsConfirmation = eventType.requiresConfirmation && reschedule != true; const isCancelled = status === "CANCELLED" || status === "REJECTED"; const telemetry = useTelemetry(); diff --git a/packages/core/event.ts b/packages/core/event.ts index 007c23fcd2..bb5cb2b3ca 100644 --- a/packages/core/event.ts +++ b/packages/core/event.ts @@ -11,7 +11,7 @@ export type EventNameObjectType = { t: TFunction; }; -export function getEventName(eventNameObj: EventNameObjectType) { +export function getEventName(eventNameObj: EventNameObjectType, forAttendeeView = false) { if (!eventNameObj.eventName) return eventNameObj.t("event_between_users", { eventName: eventNameObj.eventType, @@ -22,12 +22,13 @@ export function getEventName(eventNameObj: EventNameObjectType) { let eventName = eventNameObj.eventName; let locationString = eventNameObj.location || ""; - if (eventNameObj.eventName.includes("{Location}")) { + if (eventNameObj.eventName.includes("{Location}") || eventNameObj.eventName.includes("{LOCATION}")) { const eventLocationType = guessEventLocationType(eventNameObj.location); if (eventLocationType) { locationString = eventLocationType.label; } eventName = eventName.replace("{Location}", locationString); + eventName = eventName.replace("{LOCATION}", locationString); } return ( @@ -36,5 +37,9 @@ export function getEventName(eventNameObj: EventNameObjectType) { .replace("{Event type title}", eventNameObj.eventType) .replace("{Scheduler}", eventNameObj.attendeeName) .replace("{Organiser}", eventNameObj.host) + .replace("{USER}", eventNameObj.attendeeName) + .replace("{ATTENDEE}", eventNameObj.attendeeName) + .replace("{HOST}", eventNameObj.host) + .replace("{HOST/ATTENDEE}", forAttendeeView ? eventNameObj.host : eventNameObj.attendeeName) ); }