fix: Add guests via URL param even if field is hidden (#23229)

* Add guests via URL param even if field is hidden

* Clean up
This commit is contained in:
Joe Au-Yeung authored and GitHub committed 2025-08-21 02:27:52 +00:00
1 parent 3f8d2f2b38
commit b9aee3b18c
2 files changed
+4 -2

No files matched your search

@@ -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] = [];
}
@@ -64,6 +64,7 @@ const _getBookingData = async <T extends z.ZodType>({
getCalEventResponses({
bookingFields: eventType.bookingFields,
responses,
seatsEnabled: !!eventType.seatsPerTimeSlot,
});
return {
...parsedBody,