From 84f64f5d0653aaba0a5811dfc04208b254c24041 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Mon, 3 Apr 2023 14:48:12 +0530 Subject: [PATCH] Show correct label in email and make sure that rechedule reason is shown on booking success page (#8053) --- packages/features/bookings/lib/handleNewBooking.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts index 550504298e..cb04e6f34d 100644 --- a/packages/features/bookings/lib/handleNewBooking.ts +++ b/packages/features/bookings/lib/handleNewBooking.ts @@ -1084,7 +1084,7 @@ async function handler( await sendRescheduledEmails({ ...copyEvent, additionalNotes, // Resets back to the additionalNote input and not the override value - cancellationReason: "$RCH$" + rescheduleReason ? rescheduleReason : "", // Removable code prefix to differentiate cancellation from rescheduling for email + cancellationReason: "$RCH$" + (rescheduleReason ? rescheduleReason : ""), // Removable code prefix to differentiate cancellation from rescheduling for email }); } const resultBooking = await resultBookingQuery(newBooking.id); @@ -1189,7 +1189,7 @@ async function handler( await sendRescheduledEmails({ ...copyEvent, additionalNotes, // Resets back to the additionalNote input and not the override value - cancellationReason: "$RCH$" + rescheduleReason ? rescheduleReason : "", // Removable code prefix to differentiate cancellation from rescheduling for email + cancellationReason: "$RCH$" + (rescheduleReason ? rescheduleReason : ""), // Removable code prefix to differentiate cancellation from rescheduling for email }); // Update the old booking with the cancelled status @@ -1519,6 +1519,9 @@ async function handler( }; newBookingData["paid"] = originalRescheduledBooking.paid; newBookingData["fromReschedule"] = originalRescheduledBooking.uid; + if (originalRescheduledBooking.uid) { + newBookingData.cancellationReason = rescheduleReason; + } if (newBookingData.attendees?.createMany?.data) { // Reschedule logic with booking with seats if (eventType?.seatsPerTimeSlot && bookerEmail) { @@ -1733,7 +1736,7 @@ async function handler( ...copyEvent, additionalInformation: metadata, additionalNotes, // Resets back to the additionalNote input and not the override value - cancellationReason: "$RCH$" + rescheduleReason ? rescheduleReason : "", // Removable code prefix to differentiate cancellation from rescheduling for email + cancellationReason: "$RCH$" + (rescheduleReason ? rescheduleReason : ""), // Removable code prefix to differentiate cancellation from rescheduling for email }); } }