Summary
This PR implements guest availability checking during host reschedule to address issue #16378. When a host reschedules a booking, the system now checks if attendees who are Cal.com users are available at the new time and only shows mutually available slots.
Revives closed PR #22550 - rebased on latest main with a fresh implementation.
Changes Made
- Core Logic: Added
getGuestBusyTimesForReschedule method in AvailableSlotsService to fetch busy times for Cal.com guest users
- Availability Integration: Modified
getUsersAvailability to include guest busy times in availability calculation
- Repository Methods: Added
findUsersByEmails and findBookingsByUserIdsAndDateRange methods
- Scheduling Logic: Only applies guest availability checking for non-collective scheduling types
- Comprehensive Testing: Added test cases covering various scenarios
Technical Details
The implementation works by:
- Fetching the original booking’s attendees during reschedule
- Identifying which attendees are Cal.com users via email lookup
- Retrieving busy times for those Cal.com users
- Including guest busy times in the host’s availability calculation
- Filtering out slots where any guest is busy
Type of Change
- New feature (non-breaking change which adds functionality)
Test plan
- Excludes slots when Cal.com guest users are busy
- Includes all slots when guests are not Cal.com users
- Handles multiple Cal.com guest users correctly
- Bypasses guest availability check for collective events
Fixes #16378
/claim #16378