Scheduling infrastructure for absolutely everyone.
fix: Add guests via URL param even if field is hidden (#23229)
Joe Au-Yeungb9aee3b18c6b
diff --git a/packages/features/bookings/lib/getCalEventResponses.ts b/packages/features/bookings/lib/getCalEventResponses.tsindex 21a0318e4e9..a3360b6ee76 100644--- a/packages/features/bookings/lib/getCalEventResponses.ts+++ b/packages/features/bookings/lib/getCalEventResponses.ts@@ -13,6 +13,7 @@ export const getCalEventResponses = ({bookingFields,booking,responses,+ seatsEnabled,}: {// If the eventType has been deleted and a booking is Accepted later on, then bookingFields will be null and we can't know the label of fields. So, we should store the label as well in the DB// Also, it is no longer straightforward to identify if a field is system field or not@@ -32,6 +33,7 @@ export const getCalEventResponses = ({};}>;responses?: z.infer<typeof bookingResponsesDbSchema>;+ seatsEnabled?: boolean;}) => {const calEventUserFieldsResponses = {} as NonNullable<CalendarEvent["userFieldsResponses"]>;const calEventResponses = {} as NonNullable<CalendarEvent["responses"]>;@@ -61,8 +63,7 @@ export const getCalEventResponses = ({throw new Error(`Missing label for booking field "${field.name}"`);}- // If the guests field is hidden (disableGuests is set on the event type) don't try and infer guests from attendees list- if (field.name == "guests" && field.hidden) {+ if (field.name == "guests" && !!seatsEnabled) {backwardCompatibleResponses[field.name] = [];}diff --git a/packages/features/bookings/lib/handleNewBooking/getBookingData.ts b/packages/features/bookings/lib/handleNewBooking/getBookingData.tsindex 553e356e55a..32c6fec993d 100644--- a/packages/features/bookings/lib/handleNewBooking/getBookingData.ts+++ b/packages/features/bookings/lib/handleNewBooking/getBookingData.ts@@ -64,6 +64,7 @@ const _getBookingData = async <T extends z.ZodType>({getCalEventResponses({bookingFields: eventType.bookingFields,responses,+ seatsEnabled: !!eventType.seatsPerTimeSlot,});return {...parsedBody,