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:
co-authored by
hariom@cal.com <hariom@cal.com>
hariom@cal.com <hariom@cal.com>
hariom@cal.com <hariom@cal.com>
hariom@cal.com <hariom@cal.com>
hariom@cal.com <hariom@cal.com>
hariom@cal.com <hariom@cal.com>
hariom@cal.com <hariom@cal.com>
hariom@cal.com <hariom@cal.com>
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
hariom@cal.com <hariom@cal.com>
Anik Dhabal Babu
unknown
Hariom Balhara
parent
55a80ba253
commit
11bddbb71d
@@ -252,8 +252,8 @@ test.describe("pro user", () => {
|
||||
|
||||
await page.goto(`/reschedule/${bookingCancelledId}`);
|
||||
|
||||
// Should be redirected to the original event link
|
||||
await expect(page).toHaveURL(new RegExp(`/${pro.username}/${eventSlug}`));
|
||||
expect(page.url()).not.toContain("rescheduleUid");
|
||||
await expect(cancelledHeadline).toBeVisible();
|
||||
});
|
||||
|
||||
test("can book an event that requires confirmation and then that booking can be accepted by organizer", async ({
|
||||
|
||||
@@ -389,6 +389,62 @@ test.describe("Reschedule Tests", async () => {
|
||||
// It is tested in teams.e2e.ts
|
||||
});
|
||||
|
||||
test("Should redirect to cancelled page when allowReschedulingCancelledBookings is false (default)", async ({
|
||||
page,
|
||||
users,
|
||||
bookings,
|
||||
}) => {
|
||||
const user = await users.create();
|
||||
const eventType = user.eventTypes[0];
|
||||
|
||||
await prisma.eventType.update({
|
||||
where: {
|
||||
id: eventType.id,
|
||||
},
|
||||
data: {
|
||||
allowReschedulingCancelledBookings: false,
|
||||
},
|
||||
});
|
||||
|
||||
const booking = await bookings.create(user.id, user.username, eventType.id, {
|
||||
status: BookingStatus.CANCELLED,
|
||||
});
|
||||
|
||||
await page.goto(`/reschedule/${booking.uid}`);
|
||||
|
||||
expect(page.url()).not.toContain("rescheduleUid");
|
||||
await expect(page.locator('[data-testid="cancelled-headline"]')).toBeVisible();
|
||||
});
|
||||
|
||||
test("Should allow rescheduling when allowReschedulingCancelledBookings is true", async ({
|
||||
page,
|
||||
users,
|
||||
bookings,
|
||||
}) => {
|
||||
const user = await users.create();
|
||||
const eventType = user.eventTypes[0];
|
||||
|
||||
await prisma.eventType.update({
|
||||
where: {
|
||||
id: eventType.id,
|
||||
},
|
||||
data: {
|
||||
allowReschedulingCancelledBookings: true,
|
||||
},
|
||||
});
|
||||
|
||||
const booking = await bookings.create(user.id, user.username, eventType.id, {
|
||||
status: BookingStatus.CANCELLED,
|
||||
});
|
||||
|
||||
await page.goto(`/reschedule/${booking.uid}`);
|
||||
|
||||
await selectFirstAvailableTimeSlotNextMonth(page);
|
||||
await bookTimeSlot(page);
|
||||
|
||||
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||
});
|
||||
|
||||
test.describe("Organization", () => {
|
||||
test("Booking should be rescheduleable for a user that was moved to an organization through org domain", async ({
|
||||
users,
|
||||
|
||||
Reference in New Issue
Block a user