Skip to content

fix: Rescheduling seated events creates a seperate booking #22371

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

romitg2
Copy link
Contributor

@romitg2 romitg2 commented Jul 10, 2025

solution:

when host want to reschedule don't pass seat uid

After:

Screen.Recording.2025-07-10.at.2.39.40.PM.mov

Before:

Screen.Recording.2025-07-10.at.2.41.48.PM.mov

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

Summary by cubic

Fixed an issue where rescheduling a seated event created a separate booking by removing the seat reference from the reschedule link.

Copy link

vercel bot commented Jul 10, 2025

@romitg2 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Jul 10, 2025
@graphite-app graphite-app bot requested a review from a team July 10, 2025 09:08
@github-actions github-actions bot added bookings area: bookings, availability, timezones, double booking seats area: seats, guest meetings, multiple people 🐛 bug Something isn't working labels Jul 10, 2025
Copy link

graphite-app bot commented Jul 10, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (07/10/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add community label" took an action on this PR • (07/10/25)

1 label was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (07/13/25)

1 label was added to this PR based on Keith Williams's automation.

@kart1ka
Copy link
Contributor

kart1ka commented Jul 10, 2025

Hey @romitg2, Thanks for the PR. Could you pls check this comment here and try to fix that as well?

#22343 (comment)

@romitg2
Copy link
Contributor Author

romitg2 commented Jul 10, 2025

@kart1ka fixed

kart1ka
kart1ka previously approved these changes Jul 13, 2025
Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

github-actions bot commented Jul 13, 2025

E2E results are ready!

Comment on lines 253 to 255
href: `/reschedule/${booking.uid}${
booking.seatsReferences.length ? `?seatReferenceUid=${getSeatReferenceUid()}` : ""
}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we only excluding it when a host reschedule it? But it is currently same for an attendee also, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you're right. also surprisingly, currently attendee can't even reschedule seated booking from bookings page, flow seems broken.

Screen.Recording.2025-07-15.at.1.29.39.PM.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anikdhabal @kart1ka fixed, review 🙏

Copy link
Contributor

coderabbitai bot commented Jul 15, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

"""

Walkthrough

The changes modify the getSeatReferenceUid function in BookingListItem.tsx to return the seat reference UID matching the current user's email instead of the first seat reference. The reschedule action's URL conditionally appends the seat reference UID only if it exists, and the cancel action URL no longer appends it. Additionally, server-side logic in getServerSideProps is updated to allow rescheduling if a seat reference UID is provided, even when the user is not a host or owner.

Changes

Files Change Summary
apps/web/components/booking/BookingListItem.tsx Modified getSeatReferenceUid to return seat reference UID matching attendee email; updated reschedule and cancel action URLs accordingly
apps/web/lib/reschedule/[uid]/getServerSideProps.ts Refined access control to allow rescheduling when seatReferenceUid exists even if user is not host or owner

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

The changes are localized to two files with moderate complexity: one involves refining a function to match seat references by email and adjusting URL construction logic, and the other modifies conditional access control logic in server-side props. Both changes are straightforward and limited in scope.

Assessment against linked issues

Objective Addressed Explanation
Fix rescheduling from booking list to prevent creation of separate bookings (#22343, CAL-6064)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Poem

🐇 In code’s green meadow, a seat found its way,
Matching emails to keep bugs at bay.
Reschedule links now smartly align,
No double bookings—everything’s fine!
Hopping through logic, so nimble and fleet,
Our booking code’s fixed—no more repeat! 🌿✨
"""

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@romitg2 romitg2 requested a review from a team as a code owner July 15, 2025 11:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0975962 and 1e18f2c.

📒 Files selected for processing (2)
  • apps/web/components/booking/BookingListItem.tsx (3 hunks)
  • apps/web/lib/reschedule/[uid]/getServerSideProps.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/components/booking/BookingListItem.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Security Check

Comment on lines 191 to 192
// If the user is not a host or the owner of the event type and no seat reference uid is provided, return not found
// If user is not host or owner but has a seat reference uid, then allow reschedule
if (!userIsHost && !userIsOwnerOfEventType && !seatReferenceUid) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Logic change looks correct for seated event rescheduling.

The updated conditional logic properly allows non-hosts/non-owners to reschedule seated events when they provide a valid seat reference UID. This aligns with the PR objective of fixing rescheduling issues for seated events.

However, ensure that the seatReferenceUid is properly validated to prevent unauthorized access.


🏁 Script executed:

#!/bin/bash
# Description: Verify that seatReferenceUid validation exists elsewhere in the codebase
# Expected: Find validation logic that ensures seatReferenceUid belongs to the current user

# Search for seatReferenceUid validation logic
rg -A 10 -B 5 "seatReferenceUid.*validation|validate.*seatReferenceUid" --type ts
echo "---"

# Search for maybeGetBookingUidFromSeat implementation to understand how seat reference is handled
rg -A 15 "maybeGetBookingUidFromSeat" --type ts
echo "---"

# Search for any security checks around seat references
rg -A 5 -B 5 "seat.*reference.*uid|seatReferenceUid.*user|user.*seatReferenceUid" --type ts

Length of output: 11164


Confirm seatReferenceUid validation is missing and needs implementation

Our search shows no existing checks confirming that a provided seatReferenceUid actually belongs to the current user. Without this, anyone could supply a valid seatReferenceUid in the URL and reschedule another attendee’s booking.

Please add a check in getServerSideProps to ensure the maybeSeatReferenceUid (from maybeGetBookingUidFromSeat) is owned by session.user.id before allowing reschedule. For example, after fetching bookingSeat, verify its userId matches the logged-in user and return notFound otherwise.

• Location: apps/web/lib/reschedule/[uid]/getServerSideProps.ts: lines 170–200
• Add after maybeGetBookingUidFromSeat call:

// After fetching maybeSeatReferenceUid and bookingUid:
if (maybeSeatReferenceUid && bookingSeat.userId !== session.user.id) {
  return { notFound: true } as const;
}
🤖 Prompt for AI Agents
In apps/web/lib/reschedule/[uid]/getServerSideProps.ts around lines 170 to 200,
add a validation after retrieving maybeSeatReferenceUid and bookingSeat to
confirm that bookingSeat.userId matches session.user.id. If they do not match,
return { notFound: true } to prevent unauthorized rescheduling using someone
else's seatReferenceUid. This ensures only the owner of the seatReferenceUid can
proceed with rescheduling.

@anikdhabal anikdhabal added the Medium priority Created by Linear-GitHub Sync label Jul 16, 2025
Copy link
Contributor

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added Stale and removed Stale labels Jul 31, 2025
@romitg2 romitg2 requested a review from kart1ka August 1, 2025 09:28
Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither cancelling nor rescheduling the seated booking works as expected. Pls see the videos attached:

https://cap.link/90sv5dmxp7qkb73

https://cap.link/gmz82t2t17m4cra

@kart1ka kart1ka marked this pull request as draft August 4, 2025 18:16
@romitg2
Copy link
Contributor Author

romitg2 commented Aug 4, 2025

Neither cancelling nor rescheduling the seated booking works as expected. Pls see the videos attached:

https://cap.link/90sv5dmxp7qkb73

https://cap.link/gmz82t2t17m4cra

weird, Thanks @kart1ka for sharing videos, will fix it shortly.

@romitg2
Copy link
Contributor Author

romitg2 commented Aug 5, 2025

@kart1ka The issue was that undefined in query param was taken literally as string type "undefined", which was causing the problems.
i've tested locally and it works now. can you please take some time and test it from your side 🙏

@romitg2 romitg2 requested a review from kart1ka August 5, 2025 20:34
Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cancellation still does not work.
Pls see the video attached.

https://cap.link/1pjbwwyq26rst1m

The title of the booking also shows "Nameless" instead of the name of the attendee.
There is also an empty seatRefUid param in the url.

Pls fix these issues.

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 🐛 bug Something isn't working community Created by Linear-GitHub Sync Medium priority Created by Linear-GitHub Sync ready-for-e2e seats area: seats, guest meetings, multiple people
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rescheduling seated events creates a seperate booking
3 participants