-
Notifications
You must be signed in to change notification settings - Fork 12k
fix: Hosts not able to cancel/reschedule the event when Disable Rescheduling/Cancelling is enabled #22281
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
fix: Hosts not able to cancel/reschedule the event when Disable Rescheduling/Cancelling is enabled #22281
Changes from all commits
6b0cbc8
fe5cc0b
cb4fb4c
9fad7a2
f4adb8d
8edc297
8542dca
2e8b63b
a88aa94
15a5262
b134b7a
bab5c12
4ae3d00
b0405f3
1d2888f
63f7b5f
eace6c2
5f9fa38
505726f
7e84114
054eba3
7d20cff
32a7faf
0026554
e89107f
bab71ec
25875b6
85ca61a
02ebfd8
610e162
02fb9da
6077874
0b26e3a
98594cb
166a5f7
5f89e3d
c163681
41c26b4
b81a194
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -153,6 +153,7 @@ export default function Success(props: PageProps) { | |||||||||||||
| ); | ||||||||||||||
| const { data: session } = useSession(); | ||||||||||||||
| const isHost = props.isLoggedInUserHost; | ||||||||||||||
| const isAdminOrOwner = props.hasTeamOrOrgPermissions; | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+156
to
157
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include event-type owner in isAdminOrOwner (currently only checks team/org admin)
Apply this diff to cover owners without relying on the later - const isAdminOrOwner = props.hasTeamOrOrgPermissions;
+ const isAdminOrOwner =
+ props.hasTeamOrOrgPermissions || (!!session?.user?.id && eventType.owner?.id === session.user.id);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| const [showUtmParams, setShowUtmParams] = useState(false); | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -377,11 +378,13 @@ export default function Success(props: PageProps) { | |||||||||||||
| const isRerouting = searchParams?.get("cal.rerouting") === "true"; | ||||||||||||||
| const isRescheduled = bookingInfo?.rescheduled; | ||||||||||||||
|
|
||||||||||||||
| const canCancelOrReschedule = !eventType?.disableCancelling || !eventType?.disableRescheduling; | ||||||||||||||
| const canCancelAndReschedule = !eventType?.disableCancelling && !eventType?.disableRescheduling; | ||||||||||||||
| const canCancelOrReschedule = | ||||||||||||||
| !eventType?.disableCancelling || !eventType?.disableRescheduling || isHost || isAdminOrOwner; | ||||||||||||||
| const canCancelAndReschedule = | ||||||||||||||
| (!eventType?.disableCancelling && !eventType?.disableRescheduling) || isHost || isAdminOrOwner; | ||||||||||||||
|
|
||||||||||||||
| const canCancel = !eventType?.disableCancelling; | ||||||||||||||
| const canReschedule = !eventType?.disableRescheduling; | ||||||||||||||
| const canCancel = !eventType?.disableCancelling || isHost || isAdminOrOwner; | ||||||||||||||
| const canReschedule = !eventType?.disableRescheduling || isHost || isAdminOrOwner; | ||||||||||||||
|
|
||||||||||||||
| const successPageHeadline = (() => { | ||||||||||||||
| if (needsConfirmationAndReschedulable) { | ||||||||||||||
|
|
||||||||||||||
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.
💡 Verification agent
🧩 Analysis chain
New context flags are appropriate; confirm all call sites provide them
isHostOrOwner and hasTeamOrOrgPermissions are required booleans. Ensure all callers constructing BookingActionContext set these fields; otherwise, TS will flag.
Use:
🏁 Script executed:
Length of output: 247
🏁 Script executed:
Length of output: 7118
🏁 Script executed:
Length of output: 5301
🏁 Script executed:
Length of output: 1966
Add missing context flags in tests
The new flags
isHostOrOwnerandhasTeamOrOrgPermissionsare required on everyBookingActionContext. Verification shows:BookingListItem.tsx, both flags (andattendeeList) are provided.bookingActions.test.ts,createMockContextomits those fields and uses a type assertion—so at runtimecontext.isHostOrOwnerandcontext.hasTeamOrOrgPermissionswill beundefined.Please update
createMockContextinapps/web/components/booking/bookingActions.test.tsto include default values for these flags, for example:function createMockContext(overrides: Partial<BookingActionContext> = {}): BookingActionContext { // …existing properties… cardCharged: false, attendeeList: [ /*…*/ ], getSeatReferenceUid: () => undefined, t: mockT, + isHostOrOwner: false, + hasTeamOrOrgPermissions: false, ...overrides, } as BookingActionContext;📝 Committable suggestion
🤖 Prompt for AI Agents