fix: resolve undefined {CANCEL_URL} in workflow templates (#23476)

* uid and seatReference fix

* Seat reference fix

* Fixed cancel url link for attendees

* changes

---------

Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
This commit is contained in:
沙什瓦特andAnik Dhabal Babu authored and GitHub committed 2025-09-04 05:07:07 +00:00
1 parent 67a2371c05
commit 3f8ce8ff50
2 files changed
+17 -7

No files matched your search

@@ -113,6 +113,7 @@ const handleSeats = async (newSeatedBookingObject: NewSeatedBookingObject) => {
smsReminderNumber: smsReminderNumber || null,
calendarEvent: {
...evt,
uid: seatedBooking.uid,
rescheduleReason,
...{
metadata,
@@ -127,7 +128,7 @@ const handleSeats = async (newSeatedBookingObject: NewSeatedBookingObject) => {
isRescheduleEvent: !!rescheduleUid,
isFirstRecurringEvent: true,
emailAttendeeSendToOverride: bookerEmail,
seatReferenceUid: evt.attendeeSeatId,
seatReferenceUid: resultBooking?.seatReferenceUid,
isDryRun,
});
} catch (error) {
@@ -140,6 +140,7 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>
const bookerUrl = evt.bookerUrl ?? WEBSITE_URL;
if (emailBody) {
const isEmailAttendeeAction = action === WorkflowActions.EMAIL_ATTENDEE;
const recipientEmail = getWorkflowRecipientEmail({
action,
attendeeEmail: attendeeToBeUsedInMail.email,
@@ -162,11 +163,20 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>
meetingUrl: bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl,
cancelLink: `${bookerUrl}/booking/${evt.uid}?cancel=true${
recipientEmail ? `&cancelledBy=${encodeURIComponent(recipientEmail)}` : ""
}`,
}${isEmailAttendeeAction && seatReferenceUid ? `&seatReferenceUid=${seatReferenceUid}` : ""}`,
cancelReason: evt.cancellationReason,
rescheduleLink: `${bookerUrl}/reschedule/${evt.uid}${
recipientEmail ? `?rescheduledBy=${encodeURIComponent(recipientEmail)}` : ""
recipientEmail
? `?rescheduledBy=${encodeURIComponent(recipientEmail)}${
isEmailAttendeeAction && seatReferenceUid
? `&seatReferenceUid=${encodeURIComponent(seatReferenceUid)}`
: ""
}`
: isEmailAttendeeAction && seatReferenceUid
? `?seatReferenceUid=${encodeURIComponent(seatReferenceUid)}`
: ""
}`,
rescheduleReason: evt.rescheduleReason,
ratingUrl: `${bookerUrl}/booking/${evt.uid}?rating`,
noShowUrl: `${bookerUrl}/booking/${evt.uid}?noShow=true`,
@@ -175,10 +185,9 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>
eventEndTimeInAttendeeTimezone: dayjs(endTime).tz(evt.attendees[0].timeZone),
};
const locale =
action === WorkflowActions.EMAIL_ATTENDEE
? attendeeToBeUsedInMail.language?.locale
: evt.organizer.language.locale;
const locale = isEmailAttendeeAction
? attendeeToBeUsedInMail.language?.locale
: evt.organizer.language.locale;
const emailSubjectTemplate = customTemplate(emailSubject, variables, locale, evt.organizer.timeFormat);
emailContent.emailSubject = emailSubjectTemplate.text;