fix: give reason to reassign - allow team members to reassign even if busy (#17328)

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Omar López <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-10-25 19:13:26 +00:00
1 parent b53abe93bc
commit c5402d8bd7
17 files changed
+134 -67

No files matched your search

@@ -1231,7 +1231,11 @@ async function handler(
rescheduledMembers,
eventType.metadata
);
sendRoundRobinScheduledEmailsAndSMS(copyEventAdditionalInfo, newBookedMembers, eventType.metadata);
sendRoundRobinScheduledEmailsAndSMS({
calEvent: copyEventAdditionalInfo,
members: newBookedMembers,
eventTypeMetadata: eventType.metadata,
});
sendRoundRobinCancelledEmailsAndSMS(copyEventAdditionalInfo, cancelledMembers, eventType.metadata);
} else {
// send normal rescheduled emails (non round robin event, where organizers stay the same)
@@ -42,10 +42,12 @@ export const roundRobinManualReassignment = async ({
bookingId,
newUserId,
orgId,
reassignReason,
}: {
bookingId: number;
newUserId: number;
orgId: number | null;
reassignReason?: string;
}) => {
const roundRobinReassignLogger = logger.getSubLogger({
prefix: ["roundRobinManualReassign", `${bookingId}`],
@@ -162,6 +164,7 @@ export const roundRobinManualReassignment = async ({
userId: newUserId,
title: newBookingTitle,
userPrimaryEmail: newUser.email,
reassignReason,
},
select: bookingSelect,
});
@@ -277,15 +280,24 @@ export const roundRobinManualReassignment = async ({
const { cancellationReason, ...evtWithoutCancellationReason } = evt;
// Send emails
await sendRoundRobinScheduledEmailsAndSMS(evtWithoutCancellationReason, [
{
...newUser,
name: newUser.name || "",
username: newUser.username || "",
timeFormat: getTimeFormatStringFromUserTimeFormat(newUser.timeFormat),
language: { translate: newUserT, locale: newUser.locale || "en" },
await sendRoundRobinScheduledEmailsAndSMS({
calEvent: evtWithoutCancellationReason,
members: [
{
...newUser,
name: newUser.name || "",
username: newUser.username || "",
timeFormat: getTimeFormatStringFromUserTimeFormat(newUser.timeFormat),
language: { translate: newUserT, locale: newUser.locale || "en" },
},
],
reassigned: {
name: newUser.name,
email: newUser.email,
reason: reassignReason,
byUser: originalOrganizer.name || undefined,
},
]);
});
// Send cancellation email to previous RR host
const cancelledEvt = cloneDeep(evt);
@@ -324,15 +324,18 @@ export const roundRobinReassignment = async ({
});
// Send to new RR host
await sendRoundRobinScheduledEmailsAndSMS(evt, [
{
...reassignedRRHost,
name: reassignedRRHost.name || "",
username: reassignedRRHost.username || "",
timeFormat: getTimeFormatStringFromUserTimeFormat(reassignedRRHost.timeFormat),
language: { translate: reassignedRRHostT, locale: reassignedRRHost.locale || "en" },
},
]);
await sendRoundRobinScheduledEmailsAndSMS({
calEvent: evt,
members: [
{
...reassignedRRHost,
name: reassignedRRHost.name || "",
username: reassignedRRHost.username || "",
timeFormat: getTimeFormatStringFromUserTimeFormat(reassignedRRHost.timeFormat),
language: { translate: reassignedRRHostT, locale: reassignedRRHost.locale || "en" },
},
],
});
if (previousRRHost) {
// Send to cancelled RR host