feat: add setting to allow booking through a reschedule link (#21652)

* feat: add setting to disable rescheduling cancelled bookings

Co-Authored-By: hariom@cal.com <hariom@cal.com>

* fix: resolve type errors for disableReschedulingCancelledBookings field

Co-Authored-By: hariom@cal.com <hariom@cal.com>

* fix: update test expectations and builder to include disableReschedulingCancelledBookings field

Co-Authored-By: hariom@cal.com <hariom@cal.com>

* fix: add disableReschedulingCancelledBookings field to managed event types

Co-Authored-By: hariom@cal.com <hariom@cal.com>

* fix: remove duplicate disableReschedulingCancelledBookings property in test

Co-Authored-By: hariom@cal.com <hariom@cal.com>

* fix: change default value to true for disableReschedulingCancelledBookings

Co-Authored-By: hariom@cal.com <hariom@cal.com>

* fix: update managed event types to use true as default for disableReschedulingCancelledBookings

Co-Authored-By: hariom@cal.com <hariom@cal.com>

* test: add comprehensive tests for disableReschedulingCancelledBookings feature

Co-Authored-By: hariom@cal.com <hariom@cal.com>

* update and remove unnecesarry test

* update e2e test

* Update reschedule.e2e.ts

* update

* fix

* Reverse the meaning of column

* Simpify logic of rescheduling redirects

* fix test

* revert

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: hariom@cal.com <hariom@cal.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Co-authored-by: unknown <adhabal2002@gmail.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-06-07 22:30:54 +02:00
1 parent 55a80ba253
commit 11bddbb71d
16 files changed
+132 -10

No files matched your search

@@ -187,6 +187,7 @@ export default async function handleChildrenEventTypes({
rrSegmentQueryValue: undefined,
assignRRMembersUsingSegment: false,
useEventLevelSelectedCalendars: false,
allowReschedulingCancelledBookings: managedEventTypeValues.allowReschedulingCancelledBookings ?? false,
},
});
})
@@ -259,6 +260,7 @@ export default async function handleChildrenEventTypes({
: {
deleteMany: {},
},
allowReschedulingCancelledBookings: managedEventTypeValues.allowReschedulingCancelledBookings ?? false,
metadata: {
...(eventType.metadata as Prisma.JsonObject),
...(metadata?.multipleDuration && "length" in unlockedFieldProps
@@ -497,6 +497,9 @@ export const EventAdvancedTab = ({
const disableCancellingLocked = shouldLockDisableProps("disableCancelling");
const disableReschedulingLocked = shouldLockDisableProps("disableRescheduling");
const allowReschedulingCancelledBookingsLocked = shouldLockDisableProps(
"allowReschedulingCancelledBookings"
);
const { isLocked, ...eventNameLocked } = shouldLockDisableProps("eventName");
@@ -508,6 +511,10 @@ export const EventAdvancedTab = ({
const [disableRescheduling, setDisableRescheduling] = useState(eventType.disableRescheduling || false);
const [allowReschedulingCancelledBookings, setallowReschedulingCancelledBookings] = useState(
eventType.allowReschedulingCancelledBookings ?? false
);
const closeEventNameTip = () => setShowEventNameTip(false);
const [isEventTypeColorChecked, setIsEventTypeColorChecked] = useState(!!eventType.eventTypeColor);
@@ -1028,6 +1035,26 @@ export const EventAdvancedTab = ({
/>
)}
/>
<Controller
name="allowReschedulingCancelledBookings"
render={({ field: { onChange } }) => (
<SettingsToggle
labelClassName="text-sm"
toggleSwitchAtTheEnd={true}
switchContainerClassName="border-subtle rounded-lg border py-6 px-4 sm:px-6"
title={t("allow_rescheduling_cancelled_bookings")}
data-testid="allow-rescheduling-cancelled-bookings-toggle"
{...allowReschedulingCancelledBookingsLocked}
description={t("description_allow_rescheduling_cancelled_bookings")}
checked={allowReschedulingCancelledBookings}
onCheckedChange={(val) => {
setallowReschedulingCancelledBookings(val);
onChange(val);
}}
/>
)}
/>
{!isPlatform && (
<>
<Controller
@@ -84,6 +84,7 @@ const getPublicEventSelect = (fetchAllUsers: boolean) => {
seatsPerTimeSlot: true,
disableCancelling: true,
disableRescheduling: true,
allowReschedulingCancelledBookings: true,
seatsShowAvailabilityCount: true,
bookingFields: true,
teamId: true,
@@ -528,6 +529,7 @@ export const getPublicEvent = async (
assignAllTeamMembers: event.assignAllTeamMembers,
disableCancelling: event.disableCancelling,
disableRescheduling: event.disableRescheduling,
allowReschedulingCancelledBookings: event.allowReschedulingCancelledBookings,
interfaceLanguage: event.interfaceLanguage,
};
};
+1
View File
@@ -33,6 +33,7 @@ export const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
disableGuests: true,
disableCancelling: true,
disableRescheduling: true,
allowReschedulingCancelledBookings: true,
hideCalendarNotes: true,
minimumBookingNotice: true,
beforeEventBuffer: true,
@@ -517,6 +517,7 @@ export class EventTypeRepository {
disableGuests: true,
disableCancelling: true,
disableRescheduling: true,
allowReschedulingCancelledBookings: true,
minimumBookingNotice: true,
beforeEventBuffer: true,
afterEventBuffer: true,
+1
View File
@@ -126,6 +126,7 @@ export const buildEventType = (eventType?: Partial<EventType>): EventType => {
seatsShowAttendees: null,
disableCancelling: false,
disableRescheduling: false,
allowReschedulingCancelledBookings: false,
seatsShowAvailabilityCount: null,
maxLeadThreshold: null,
includeNoShowInRRCalculation: false,
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "EventType" ADD COLUMN "allowReschedulingCancelledBookings" BOOLEAN DEFAULT false;
+1
View File
@@ -152,6 +152,7 @@ model EventType {
schedulingType SchedulingType?
schedule Schedule? @relation(fields: [scheduleId], references: [id])
scheduleId Int?
allowReschedulingCancelledBookings Boolean? @default(false)
// price is deprecated. It has now moved to metadata.apps.stripe.price. Plan to drop this column.
price Int @default(0)
// currency is deprecated. It has now moved to metadata.apps.stripe.currency. Plan to drop this column.
+1
View File
@@ -629,6 +629,7 @@ export const allManagedEventTypeProps: { [k in keyof Omit<Prisma.EventTypeSelect
disableGuests: true,
disableCancelling: true,
disableRescheduling: true,
allowReschedulingCancelledBookings: true,
requiresConfirmation: true,
canSendCalVideoTranscriptionEmails: true,
requiresConfirmationForFreeEmail: true,