fix: v2 booking confirmation emails not sent (#17764)
* fix: round robin recurring don't send email if noEmail * fix: noEmail: false for non platform requests * fix: booking e2e tests * refactor: move bookings e2e tests in folder and uniform name * test: emails * test: team emails * reschedule and cancel emails with api key * test: round robin reassign emails * test: confirm and decline emails * test: confirm and decline emails * fix tests * test: recurring booking emails * remove unused imports and spies * fix test * remove log * chore: bump libraries * try to fix ci tests
This commit is contained in:
1 parent
8e7ce1216c
commit
9fa73aca86
34 files changed
+2544
-358
No files matched your search
@@ -67,8 +67,9 @@ export async function handleConfirmation(args: {
|
||||
userId: number | null;
|
||||
};
|
||||
paid?: boolean;
|
||||
emailsEnabled?: boolean;
|
||||
}) {
|
||||
const { user, evt, recurringEventId, prisma, bookingId, booking, paid } = args;
|
||||
const { user, evt, recurringEventId, prisma, bookingId, booking, paid, emailsEnabled = true } = args;
|
||||
const eventType = booking.eventType;
|
||||
const eventTypeMetadata = EventTypeMetaDataSchema.parse(eventType?.metadata || {});
|
||||
const eventManager = new EventManager(user, eventTypeMetadata?.apps);
|
||||
@@ -113,13 +114,15 @@ export async function handleConfirmation(args: {
|
||||
}
|
||||
}
|
||||
|
||||
await sendScheduledEmailsAndSMS(
|
||||
{ ...evt, additionalInformation: metadata },
|
||||
undefined,
|
||||
isHostConfirmationEmailsDisabled,
|
||||
isAttendeeConfirmationEmailDisabled,
|
||||
eventTypeMetadata
|
||||
);
|
||||
if (emailsEnabled) {
|
||||
await sendScheduledEmailsAndSMS(
|
||||
{ ...evt, additionalInformation: metadata },
|
||||
undefined,
|
||||
isHostConfirmationEmailsDisabled,
|
||||
isAttendeeConfirmationEmailDisabled,
|
||||
eventTypeMetadata
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export const handleNewRecurringBooking = async (
|
||||
thirdPartyRecurringEventId,
|
||||
numSlotsToCheckForAvailability,
|
||||
currentRecurringIndex: 0,
|
||||
noEmail: false,
|
||||
noEmail: req.noEmail !== undefined ? req.noEmail : false,
|
||||
};
|
||||
|
||||
const firstBookingResult = await handleNewBooking(recurringEventReq);
|
||||
|
||||
@@ -44,12 +44,14 @@ export const roundRobinManualReassignment = async ({
|
||||
orgId,
|
||||
reassignReason,
|
||||
reassignedById,
|
||||
emailsEnabled = true,
|
||||
}: {
|
||||
bookingId: number;
|
||||
newUserId: number;
|
||||
orgId: number | null;
|
||||
reassignReason?: string;
|
||||
reassignedById: number;
|
||||
emailsEnabled?: boolean;
|
||||
}) => {
|
||||
const roundRobinReassignLogger = logger.getSubLogger({
|
||||
prefix: ["roundRobinManualReassign", `${bookingId}`],
|
||||
@@ -289,24 +291,26 @@ export const roundRobinManualReassignment = async ({
|
||||
const { cancellationReason, ...evtWithoutCancellationReason } = evtWithAdditionalInfo;
|
||||
|
||||
// Send emails
|
||||
await sendRoundRobinScheduledEmailsAndSMS({
|
||||
calEvent: evtWithoutCancellationReason,
|
||||
members: [
|
||||
{
|
||||
...newUser,
|
||||
name: newUser.name || "",
|
||||
username: newUser.username || "",
|
||||
timeFormat: getTimeFormatStringFromUserTimeFormat(newUser.timeFormat),
|
||||
language: { translate: newUserT, locale: newUser.locale || "en" },
|
||||
if (emailsEnabled) {
|
||||
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,
|
||||
},
|
||||
],
|
||||
reassigned: {
|
||||
name: newUser.name,
|
||||
email: newUser.email,
|
||||
reason: reassignReason,
|
||||
byUser: originalOrganizer.name || undefined,
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Send cancellation email to previous RR host
|
||||
const cancelledEvt = cloneDeep(evtWithAdditionalInfo);
|
||||
@@ -317,7 +321,7 @@ export const roundRobinManualReassignment = async ({
|
||||
language: { translate: originalOrganizerT, locale: originalOrganizer.locale || "en" },
|
||||
};
|
||||
|
||||
if (previousRRHost) {
|
||||
if (previousRRHost && emailsEnabled) {
|
||||
await sendRoundRobinCancelledEmailsAndSMS(
|
||||
cancelledEvt,
|
||||
[
|
||||
|
||||
@@ -37,9 +37,11 @@ import { getTeamMembers } from "./utils/getTeamMembers";
|
||||
export const roundRobinReassignment = async ({
|
||||
bookingId,
|
||||
orgId,
|
||||
emailsEnabled = true,
|
||||
}: {
|
||||
bookingId: number;
|
||||
orgId: number | null;
|
||||
emailsEnabled?: boolean;
|
||||
}) => {
|
||||
const roundRobinReassignLogger = logger.getSubLogger({
|
||||
prefix: ["roundRobinReassign", `${bookingId}`],
|
||||
@@ -321,18 +323,20 @@ export const roundRobinReassignment = async ({
|
||||
const { cancellationReason, ...evtWithoutCancellationReason } = evtWithAdditionalInfo;
|
||||
|
||||
// Send to new RR host
|
||||
await sendRoundRobinScheduledEmailsAndSMS({
|
||||
calEvent: evtWithoutCancellationReason,
|
||||
members: [
|
||||
{
|
||||
...reassignedRRHost,
|
||||
name: reassignedRRHost.name || "",
|
||||
username: reassignedRRHost.username || "",
|
||||
timeFormat: getTimeFormatStringFromUserTimeFormat(reassignedRRHost.timeFormat),
|
||||
language: { translate: reassignedRRHostT, locale: reassignedRRHost.locale || "en" },
|
||||
},
|
||||
],
|
||||
});
|
||||
if (emailsEnabled) {
|
||||
await sendRoundRobinScheduledEmailsAndSMS({
|
||||
calEvent: evtWithoutCancellationReason,
|
||||
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
|
||||
@@ -365,20 +369,22 @@ export const roundRobinReassignment = async ({
|
||||
});
|
||||
}
|
||||
|
||||
await sendRoundRobinCancelledEmailsAndSMS(
|
||||
cancelledRRHostEvt,
|
||||
[
|
||||
{
|
||||
...previousRRHost,
|
||||
name: previousRRHost.name || "",
|
||||
username: previousRRHost.username || "",
|
||||
timeFormat: getTimeFormatStringFromUserTimeFormat(previousRRHost.timeFormat),
|
||||
language: { translate: previousRRHostT, locale: previousRRHost.locale || "en" },
|
||||
},
|
||||
],
|
||||
eventType?.metadata as EventTypeMetadata,
|
||||
{ name: reassignedRRHost.name, email: reassignedRRHost.email }
|
||||
);
|
||||
if (emailsEnabled) {
|
||||
await sendRoundRobinCancelledEmailsAndSMS(
|
||||
cancelledRRHostEvt,
|
||||
[
|
||||
{
|
||||
...previousRRHost,
|
||||
name: previousRRHost.name || "",
|
||||
username: previousRRHost.username || "",
|
||||
timeFormat: getTimeFormatStringFromUserTimeFormat(previousRRHost.timeFormat),
|
||||
language: { translate: previousRRHostT, locale: previousRRHost.locale || "en" },
|
||||
},
|
||||
],
|
||||
eventType?.metadata as EventTypeMetadata,
|
||||
{ name: reassignedRRHost.name, email: reassignedRRHost.email }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle changing workflows with organizer
|
||||
|
||||
Reference in new issue
Block a user