Skip to content

Commit b9aee3b

Browse files
authored
fix: Add guests via URL param even if field is hidden (calcom#23229)
* Add guests via URL param even if field is hidden * Clean up
1 parent 3f8d2f2 commit b9aee3b

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

packages/features/bookings/lib/getCalEventResponses.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const getCalEventResponses = ({
1313
bookingFields,
1414
booking,
1515
responses,
16+
seatsEnabled,
1617
}: {
1718
// 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
1819
// Also, it is no longer straightforward to identify if a field is system field or not
@@ -32,6 +33,7 @@ export const getCalEventResponses = ({
3233
};
3334
}>;
3435
responses?: z.infer<typeof bookingResponsesDbSchema>;
36+
seatsEnabled?: boolean;
3537
}) => {
3638
const calEventUserFieldsResponses = {} as NonNullable<CalendarEvent["userFieldsResponses"]>;
3739
const calEventResponses = {} as NonNullable<CalendarEvent["responses"]>;
@@ -61,8 +63,7 @@ export const getCalEventResponses = ({
6163
throw new Error(`Missing label for booking field "${field.name}"`);
6264
}
6365

64-
// If the guests field is hidden (disableGuests is set on the event type) don't try and infer guests from attendees list
65-
if (field.name == "guests" && field.hidden) {
66+
if (field.name == "guests" && !!seatsEnabled) {
6667
backwardCompatibleResponses[field.name] = [];
6768
}
6869

packages/features/bookings/lib/handleNewBooking/getBookingData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const _getBookingData = async <T extends z.ZodType>({
6464
getCalEventResponses({
6565
bookingFields: eventType.bookingFields,
6666
responses,
67+
seatsEnabled: !!eventType.seatsPerTimeSlot,
6768
});
6869
return {
6970
...parsedBody,

0 commit comments

Comments
 (0)