fix: Hotfix/ Dynamic Group Booking Links not working in new booker (#9685)

* Debuglogs

* Derive group usernames correctly

* Revert "Debuglogs"

This reverts commit d93f031589.
This commit is contained in:
Hariom Balhara 2023-06-21 19:52:13 +05:30 committed by GitHub
parent 4748641c22
commit 3c3db0b3a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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) {

View File

@ -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?