From 3c3db0b3a6310fc8d2097ec22dc6d5fcf7e24dc6 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Wed, 21 Jun 2023 19:52:13 +0530 Subject: [PATCH] fix: Hotfix/ Dynamic Group Booking Links not working in new booker (#9685) * Debuglogs * Derive group usernames correctly * Revert "Debuglogs" This reverts commit d93f031589b34bb7fee32a34f96eb89805c20275. --- packages/features/eventtypes/lib/getPublicEvent.ts | 4 ++-- packages/features/schedules/lib/use-schedule/useSchedule.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/features/eventtypes/lib/getPublicEvent.ts b/packages/features/eventtypes/lib/getPublicEvent.ts index 1d3014ffbb..66095bd95b 100644 --- a/packages/features/eventtypes/lib/getPublicEvent.ts +++ b/packages/features/eventtypes/lib/getPublicEvent.ts @@ -7,7 +7,7 @@ import { getAppFromSlug } from "@calcom/app-store/utils"; import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields"; import { isRecurringEvent, parseRecurringEvent } from "@calcom/lib"; import { WEBAPP_URL } from "@calcom/lib/constants"; -import { getDefaultEvent } from "@calcom/lib/defaultEvents"; +import { getDefaultEvent, getUsernameList } from "@calcom/lib/defaultEvents"; import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML"; import type { PrismaClient } from "@calcom/prisma/client"; import type { BookerLayoutSettings } from "@calcom/prisma/zod-utils"; @@ -84,7 +84,7 @@ export const getPublicEvent = async ( isTeamEvent: boolean | undefined, prisma: PrismaClient ) => { - const usernameList = username.split("+"); + const usernameList = getUsernameList(username); // In case of dynamic group event, we fetch user's data and use the default event. if (usernameList.length > 1) { diff --git a/packages/features/schedules/lib/use-schedule/useSchedule.ts b/packages/features/schedules/lib/use-schedule/useSchedule.ts index 33046b9bd2..6ea3f433bc 100644 --- a/packages/features/schedules/lib/use-schedule/useSchedule.ts +++ b/packages/features/schedules/lib/use-schedule/useSchedule.ts @@ -1,4 +1,5 @@ import dayjs from "@calcom/dayjs"; +import { getUsernameList } from "@calcom/lib/defaultEvents"; import { trpc } from "@calcom/trpc/react"; type UseScheduleWithCacheArgs = { @@ -22,13 +23,12 @@ export const useSchedule = ({ }: UseScheduleWithCacheArgs) => { const monthDayjs = month ? dayjs(month) : dayjs(); const nextMonthDayjs = monthDayjs.add(1, "month"); - // Why the non-null assertions? All of these arguments are checked in the enabled condition, // and the query will not run if they are null. However, the check in `enabled` does // no satisfy typscript. return trpc.viewer.public.slots.getSchedule.useQuery( { - usernameList: username && username.indexOf("+") > -1 ? username.split("+") : [username!], + usernameList: getUsernameList(username ?? ""), eventTypeSlug: eventSlug!, // @TODO: Old code fetched 2 days ago if we were fetching the current month. // Do we want / need to keep that behavior?