feat: Take into account guest's availability when rescheduling#27593
feat: Take into account guest's availability when rescheduling#27593JarvisInvestInsight wants to merge 3 commits intocalcom:mainfrom
Conversation
When a host reschedules a booking, this now checks if the guest (attendee) is a Cal.com user. If they are, the system fetches their availability and only shows time slots when BOTH the host AND the guest are available. This prevents hosts from rescheduling to times when the guest is busy, improving the rescheduling experience for both parties. Changes: - Added _getGuestAvailabilityForReschedule helper method - Integrated availability intersection in _getAvailableSlots - Gracefully handles errors (falls back to host-only availability) Closes calcom#16378
Previously, if a Cal.com user (guest) had NO available slots, the code treated this the same as 'not a Cal.com user' and showed host-only availability. This was incorrect - if the guest is a Cal.com user with zero availability, the result should be no available slots. Fixed by distinguishing between: - null: Guest is not a Cal.com user (show host-only availability) - []: Guest IS a Cal.com user with no availability (return no slots) - [...]: Guest has availability (intersect with host) This addresses the review feedback about empty guest availability.
Tests cover: - Returns null when booking not found - Returns null when booking has no attendees - Returns null when guest is not a Cal.com user - Returns guest availability when guest IS a Cal.com user with slots - Returns empty array when guest IS a Cal.com user with NO availability - Excludes host emails from guest list - Gracefully returns null on error (doesn't throw) These tests verify the fix for the empty guest availability bug, ensuring we distinguish between: - null: Guest is not a Cal.com user - []: Guest IS a Cal.com user with no availability - [...]: Guest has availability
|
Paragon Review Unavailable Hi @JarvisInvestInsight! To enable Paragon reviews on this repository, please register at https://home.polarity.cc Once registered, connect your GitHub account and Paragon will automatically review your pull requests. |
Graphite Automations"Send notification to Community team when bounty PR opened" took an action on this PR • (02/03/26)2 teammates were notified to this PR based on Keith Williams's automation. |
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/trpc/server/routers/viewer/slots/util.ts">
<violation number="1" location="packages/trpc/server/routers/viewer/slots/util.ts:1303">
P2: Guest availability is intersected before fallback handling, but when fallback RR hosts are used the code recomputes aggregatedAvailability without reapplying that intersection. In fallback scenarios, reschedule slots can ignore the guest’s availability. Consider reapplying the guest availability intersection after the fallback recalculation (or moving the intersection to after fallback selection).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| let aggregatedAvailability = getAggregatedAvailability(allUsersAvailability, eventType.schedulingType); | ||
|
|
||
| // When rescheduling, check if the guest is a Cal.com user and intersect their availability | ||
| if (input.rescheduleUid) { |
There was a problem hiding this comment.
P2: Guest availability is intersected before fallback handling, but when fallback RR hosts are used the code recomputes aggregatedAvailability without reapplying that intersection. In fallback scenarios, reschedule slots can ignore the guest’s availability. Consider reapplying the guest availability intersection after the fallback recalculation (or moving the intersection to after fallback selection).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/trpc/server/routers/viewer/slots/util.ts, line 1303:
<comment>Guest availability is intersected before fallback handling, but when fallback RR hosts are used the code recomputes aggregatedAvailability without reapplying that intersection. In fallback scenarios, reschedule slots can ignore the guest’s availability. Consider reapplying the guest availability intersection after the fallback recalculation (or moving the intersection to after fallback selection).</comment>
<file context>
@@ -1209,6 +1299,58 @@ export class AvailableSlotsService {
let aggregatedAvailability = getAggregatedAvailability(allUsersAvailability, eventType.schedulingType);
+ // When rescheduling, check if the guest is a Cal.com user and intersect their availability
+ if (input.rescheduleUid) {
+ const guestAvailability = await this.getGuestAvailabilityForReschedule({
+ rescheduleUid: input.rescheduleUid,
</file context>
|
@JarvisInvestInsight Thank you for contribution! could you please add video demo? |
|
This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active. |
|
Thank you for your contribution. This PR is being closed because the linked issue is no longer exists in Cal.diy. blog |
What does this PR do?
When a host reschedules a booking, this now checks if the guest (attendee) is a Cal.com user. If they are, the system fetches their availability and only shows time slots when BOTH the host AND the guest are available.
This prevents hosts from rescheduling to times when the guest is busy, improving the rescheduling experience for both parties.
Changes
escheduleUid\ is present
ull: Guest is not a Cal.com user → show host-only availability
Tests Added
Video Demo
Recording in progress - will be added shortly
Closes #16378