-
Notifications
You must be signed in to change notification settings - Fork 11.2k
feat: respect guest availability when rescheduling bookings #25689
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
base: main
Are you sure you want to change the base?
feat: respect guest availability when rescheduling bookings #25689
Conversation
|
@FizaSiddique123 is attempting to deploy a commit to the cal-staging Team on Vercel. A member of the Team first needs to authorize it. |
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
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.
1 issue found across 5 files (changes from recent commits).
Prompt for AI agents (all 1 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/teams/inviteMember/inviteMember.handler.ts">
<violation number="1">
P2: Permission check uses `team.invite` unconditionally, but should use `organization.invite` when the team is an organization. The existing `ensureAtleastAdminPermissions` (lines 294-298) correctly selects between `organization.invite` and `team.invite` based on `isOrg`. Consider using conditional permission logic: `const permission = team.isOrganization ? "organization.invite" : "team.invite"`</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
What does this PR do?
This PR updates the rescheduling logic so that it respects the availability of guests who are Cal.com users.
Previously, when a booking was rescheduled, the system only checked host availability. If the guest was also a Cal.com user and had another meeting at the rescheduled time, the UI still showed that time slot as available.
This fix ensures:
When rescheduleUid is present, the system loads the original booking.
If the attendee(s) are Cal.com users, their calendars are included as fixed guests in availability checks.
Time slots where any involved guest is busy are not shown during rescheduling.
A new automated test validates this behavior.
Fixes #16378
Fixes CAL-4531
Visual Demo
N/A (internal logic change fully covered by automated tests)
Mandatory Tasks (DO NOT REMOVE)
I have self-reviewed the code.
I have updated the developer docs if needed. → N/A
I confirm automated tests are in place verifying the fix.
How should this be tested?
Automated Testing
Run:
yarn test -- getSchedule.test.ts
The following new test verifies the fix:
reschedule: should not show times where a cal.com guest is busy
Manual Testing Steps
Create two users:
Host user (with a working-hours schedule)
Guest user (also a Cal.com user with a working-hours schedule)
Create an event type assigned to the host.
Create a booking with the guest as attendee.
Add another accepted booking for the guest at a conflicting time.
Reschedule the first booking (using its rescheduleUid).
Expected:
The conflicting time slot does NOT appear in the reschedule availability list.
Only time slots where both host and guest are free appear.
No special environment variables are required.