Skip to content

Conversation

@FizaSiddique123
Copy link

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.

@FizaSiddique123 FizaSiddique123 requested a review from a team as a code owner December 8, 2025 03:44
@vercel
Copy link

vercel bot commented Dec 8, 2025

@FizaSiddique123 is attempting to deploy a commit to the cal-staging Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Dec 8, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added $200 bookings area: bookings, availability, timezones, double booking Medium priority Created by Linear-GitHub Sync ✨ feature New feature or request 💎 Bounty A bounty on Algora.io 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Dec 8, 2025
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Dec 8, 2025
@github-actions github-actions bot added ❗️ .env changes contains changes to env variables and removed ✨ feature New feature or request 🧹 Improvements Improvements to existing features. Mostly UX/UI Medium priority Created by Linear-GitHub Sync 💎 Bounty A bounty on Algora.io bookings area: bookings, availability, timezones, double booking community Created by Linear-GitHub Sync $200 labels Dec 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

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:

No release type found in pull request title "Respect guest availability when rescheduling bookings". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@github-actions github-actions bot added $200 bookings area: bookings, availability, timezones, double booking Medium priority Created by Linear-GitHub Sync ✨ feature New feature or request 💎 Bounty A bounty on Algora.io 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Dec 8, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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 ? &quot;organization.invite&quot; : &quot;team.invite&quot;`</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

@FizaSiddique123 FizaSiddique123 changed the title Respect guest availability when rescheduling bookings feat: respect guest availability when rescheduling bookings Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking 💎 Bounty A bounty on Algora.io ❗️ .env changes contains changes to env variables ✨ feature New feature or request 🧹 Improvements Improvements to existing features. Mostly UX/UI Medium priority Created by Linear-GitHub Sync size/XXL $200

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-4531] Take into account guest's availability when rescheduling

2 participants