fix: allow owners to cancel events even if cancellation is disabled#23472
fix: allow owners to cancel events even if cancellation is disabled#23472Vibgitcode27 wants to merge 2 commits intocalcom:mainfrom
Conversation
|
@Vibgitcode27 is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe PR modifies packages/features/bookings/lib/handleCancelBooking.ts by removing the server-side guard that blocked cancellations when an event type had disableCancelling enabled. Specifically, it deletes the block that threw a 400 error with the message "This event type does not allow cancellations." No other exported/public signatures were changed. Assessment against linked issues
Possibly related PRs
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ 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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
Hey! If you think the const result = await handleCancelBooking({
bookingData,
userId: session?.user?.id || -1,
});I don't feel like that check is necessary since guests don't even get the UI to cancel when it's disabled, so I just removed it. Let me know if you want me to add the admin validation instead , I can do that change quickly! |
|
Fixed by this:- #23479 |
|
@anikdhabal Even if cancellation is disabled, shouldn’t that only apply to guests while owners should still be able to cancel the event? |
|
@Vibgitcode27 yeah that's a diff issue, I will open an issue after confirming from my team member. if we wanted that or not |
|
Should I open it? I will add need approval tag |
|
@Vibgitcode27 i will open it. No issue. Also your code not exactly fix that issue. You completely removed the logic |
|
@anikdhabal got it! I can add member check but np |
|
Found one pr:- #22281 |
|
Yeah! @asadath1395 is still working on it I guess. |
What does this PR do?
This PR fixes an issue where event owners and internal users were unable to cancel bookings when the event type had
disableCancellingenabled, even though they should have administrative privileges to do so.Issue Description:
The
handleCancelBookingfunction was throwing a 400 error with the message "This event type does not allow cancellations" when attempting to cancel bookings for event types withdisableCancellingset totrue. This restriction was blocking legitimate cancellations by event owners and internal staff members who should have the authority to cancel bookings regardless of this setting.Root Cause:
The
disableCancellingcheck in the cancellation handler was treating this setting as a system-wide restriction rather than a guest-facing UI restriction. The original logic prevented all cancellations when this flag was enabled, including those initiated by authorized internal users.Solution:
Removed the
disableCancellingvalidation check from thehandleCancelBookingfunction. This change allows:Event owners to cancel their own bookings when necessary
Internal users with access to the cancellation interface to perform administrative cancellations
Guest-facing restrictions to remain intact at the UI level (guests don't see cancel options when
disableCancellingis enabled)Fixes Cancel button is visible on managed event types after disabling cancellation #23457
Fixes CAL-6353
Video Demo (if applicable):
Before Fix (Issue Reproduction):
After Fix (Resolution):
Image Demo (if applicable):
Mandatory Tasks (DO NOT REMOVE)
Checklist