fix: allow organizer/host to cancel/reschedule even when booking options are disabled#22807
fix: allow organizer/host to cancel/reschedule even when booking options are disabled#22807sahitya-chandra wants to merge 5 commits intocalcom:mainfrom
Conversation
…of disabled booking settings
|
@sahitya-chandra is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe code changes update the logic for determining if a booking can be cancelled or rescheduled, specifically to allow the host (organizer) of the event to perform these actions even when cancellation or rescheduling is disabled for other users. In the booking view, the flags controlling cancel and reschedule permissions now check if the user is the host, in addition to the previous checks. In the booking cancellation handler, a new check is added to allow hosts to bypass the cancellation restriction, ensuring that only non-hosts are blocked when cancellation is disabled. Similarly, server-side logic for rescheduling now includes checks to allow hosts to bypass restrictions and avoid redirects that block rescheduling when disabled for others. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes were found. Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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). (2)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (07/30/25)1 reviewer was added to this PR based on Keith Williams's automation. "Add community label" took an action on this PR • (07/30/25)1 label was added to this PR based on Keith Williams's automation. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
apps/web/lib/reschedule/[uid]/getServerSideProps.ts (1)
130-130: Remove debug console.log statement.The debug console.log statement should be removed before merging to production.
- console.log("hhhhhh");apps/web/server/lib/[user]/[type]/getServerSideProps.ts (1)
50-50: Remove debug console.log statements.The debug console.log statements should be removed before merging to production.
- console.log(booking);- console.log("ooooooo");Also applies to: 56-56
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/web/lib/reschedule/[uid]/getServerSideProps.ts(1 hunks)apps/web/modules/bookings/views/bookings-single-view.tsx(1 hunks)apps/web/server/lib/[user]/[type]/getServerSideProps.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/web/modules/bookings/views/bookings-single-view.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts
📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
**/*.ts: For Prisma queries, only select data you need; never useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
apps/web/server/lib/[user]/[type]/getServerSideProps.tsapps/web/lib/reschedule/[uid]/getServerSideProps.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()in hot paths like loops
Files:
apps/web/server/lib/[user]/[type]/getServerSideProps.tsapps/web/lib/reschedule/[uid]/getServerSideProps.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.
📚 Learning: the filterhostsbysameroundrobinhost function in packages/lib/bookings/filterhostsbysameroundrobinhos...
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.
Applied to files:
apps/web/server/lib/[user]/[type]/getServerSideProps.tsapps/web/lib/reschedule/[uid]/getServerSideProps.ts
📚 Learning: in the failedbookingsbyfield component (packages/features/insights/components/failedbookingsbyfield....
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.
Applied to files:
apps/web/server/lib/[user]/[type]/getServerSideProps.tsapps/web/lib/reschedule/[uid]/getServerSideProps.ts
📚 Learning: in signup-view.tsx, when checking if redirecturl contains certain strings, using explicit && checks ...
Learnt from: Anshumancanrock
PR: calcom/cal.com#22570
File: apps/web/modules/signup-view.tsx:253-253
Timestamp: 2025-07-21T21:33:23.371Z
Learning: In signup-view.tsx, when checking if redirectUrl contains certain strings, using explicit && checks (redirectUrl && redirectUrl.includes()) is preferred over optional chaining (redirectUrl?.includes()) to ensure the result is always a boolean rather than potentially undefined. This approach provides cleaner boolean contracts for downstream conditional logic.
Applied to files:
apps/web/server/lib/[user]/[type]/getServerSideProps.tsapps/web/lib/reschedule/[uid]/getServerSideProps.ts
🧬 Code Graph Analysis (2)
apps/web/server/lib/[user]/[type]/getServerSideProps.ts (1)
packages/features/auth/lib/next-auth-options.ts (1)
session(715-740)
apps/web/lib/reschedule/[uid]/getServerSideProps.ts (1)
packages/features/auth/lib/next-auth-options.ts (1)
session(715-740)
⏰ 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). (2)
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Codacy Static Code Analysis
|
Closing in favour of #22281 |
What does this PR do?
Visual Demo (For contributors especially)
Cancel event (only host):
Screencast.from.2025-07-30.17-27-43.webm
Reschedule event (only host);
Screencast.from.2025-08-03.16-19-39.webm
A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).
Video Demo (if applicable):
Image Demo (if applicable):
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist