Scheduling infrastructure for absolutely everyone.
fix: Incorrect RR host is shown in the email and calendar event for a seated RR event (#21684)
Anik Dhabal Babue82bd45b558b
diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.tsindex 7003f1a2902..eab92f03cc2 100644--- a/packages/features/bookings/lib/handleNewBooking.ts+++ b/packages/features/bookings/lib/handleNewBooking.ts@@ -650,9 +650,31 @@ async function handler(startTime: new Date(dayjs(reqBody.start).utc().format()),status: BookingStatus.ACCEPTED,},+ select: {+ userId: true,+ attendees: { select: { email: true } },+ },});- if (booking) isFirstSeat = false;+ if (booking) {+ isFirstSeat = false;+ if (eventType.schedulingType === SchedulingType.ROUND_ROBIN) {+ const fixedHosts = users.filter((user) => user.isFixed);+ const originalNonFixedHost = users.find((user) => !user.isFixed && user.id === booking.userId);++ if (originalNonFixedHost) {+ users = [...fixedHosts, originalNonFixedHost];+ } else {+ const attendeeEmailSet = new Set(booking.attendees.map((attendee) => attendee.email));++ // In this case, the first booking user is a fixed host, so the chosen non-fixed host is added as an attendee of the booking+ const nonFixedAttendeeHost = users.find(+ (user) => !user.isFixed && attendeeEmailSet.has(user.email)+ );+ users = [...fixedHosts, ...(nonFixedAttendeeHost ? [nonFixedAttendeeHost] : [])];+ }+ }+ }}//checks what users are available