-
Notifications
You must be signed in to change notification settings - Fork 12.1k
feat(reschedule): check guest availability when host reschedules #28229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -839,6 +839,44 @@ export class AvailableSlotsService { | |||||||||||
| const allUserIds = Array.from(userIdAndEmailMap.keys()); | ||||||||||||
|
|
||||||||||||
| const bookingRepo = this.dependencies.bookingRepo; | ||||||||||||
|
|
||||||||||||
| // When rescheduling, collect accepted bookings of all guests (attendees who are not | ||||||||||||
| // the host) so we can block slots that would double-book them. | ||||||||||||
| let guestBusyTimes: EventBusyDetails[] = []; | ||||||||||||
| if (input.rescheduleUid) { | ||||||||||||
| const rescheduleBooking = await bookingRepo.findByUidIncludeEventTypeAttendeesAndUser({ | ||||||||||||
| bookingUid: input.rescheduleUid, | ||||||||||||
| }); | ||||||||||||
| if (rescheduleBooking) { | ||||||||||||
|
||||||||||||
| if (rescheduleBooking) { | |
| // Only consider guest conflicts if the reschedule booking belongs to one of the | |
| // current hosts/users participating in this scheduling flow. This prevents | |
| // unauthorized callers from probing guest availability using arbitrary UIDs. | |
| if (rescheduleBooking && rescheduleBooking.userId && allUserIds.includes(rescheduleBooking.userId)) { |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guestEmails can contain duplicates (and potentially empty strings, depending on upstream data). Deduplicating/filtering before calling getAcceptedBookingsByAttendeeEmails will reduce the size of the SQL IN (...) list and avoid unnecessary DB work.
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guestBusyTimes is populated with title from bookings that belong to the guests. This will flow into getUserAvailability's busy output and debug logs, and may expose private meeting titles unrelated to the host/reschedule flow. Consider omitting the title (or replacing with a generic label) for guest-derived busy times.
| title: b.title ?? undefined, | |
| // Do not leak guest-owned meeting titles; use a generic label instead. | |
| title: "Busy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new query method introduces important overlap/exclusion semantics but doesn't appear to be covered by repository tests. Since
BookingRepository.integration-test.tsalready sets up real bookings/attendees, adding coverage for overlap boundaries (touching endpoints), multiple emails, andexcludedUidwould help prevent regressions.