fix: Function sendScheduledSeatsEmails ignore rule 'Disable default confirmation emails for attendees' (#11722)
parent
20803451de
commit
8ebcfbb8d1
|
@ -135,20 +135,25 @@ export const sendScheduledSeatsEmails = async (
|
||||||
calEvent: CalendarEvent,
|
calEvent: CalendarEvent,
|
||||||
invitee: Person,
|
invitee: Person,
|
||||||
newSeat: boolean,
|
newSeat: boolean,
|
||||||
showAttendees: boolean
|
showAttendees: boolean,
|
||||||
|
hostEmailDisabled?: boolean,
|
||||||
|
attendeeEmailDisabled?: boolean
|
||||||
) => {
|
) => {
|
||||||
const emailsToSend: Promise<unknown>[] = [];
|
const emailsToSend: Promise<unknown>[] = [];
|
||||||
|
|
||||||
emailsToSend.push(sendEmail(() => new OrganizerScheduledEmail({ calEvent, newSeat })));
|
if (!hostEmailDisabled) {
|
||||||
|
emailsToSend.push(sendEmail(() => new OrganizerScheduledEmail({ calEvent, newSeat })));
|
||||||
|
|
||||||
if (calEvent.team) {
|
if (calEvent.team) {
|
||||||
for (const teamMember of calEvent.team.members) {
|
for (const teamMember of calEvent.team.members) {
|
||||||
emailsToSend.push(sendEmail(() => new OrganizerScheduledEmail({ calEvent, newSeat, teamMember })));
|
emailsToSend.push(sendEmail(() => new OrganizerScheduledEmail({ calEvent, newSeat, teamMember })));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emailsToSend.push(sendEmail(() => new AttendeeScheduledEmail(calEvent, invitee, showAttendees)));
|
if (!attendeeEmailDisabled) {
|
||||||
|
emailsToSend.push(sendEmail(() => new AttendeeScheduledEmail(calEvent, invitee, showAttendees)));
|
||||||
|
}
|
||||||
await Promise.all(emailsToSend);
|
await Promise.all(emailsToSend);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1736,8 +1736,35 @@ async function handler(
|
||||||
}
|
}
|
||||||
const copyEvent = cloneDeep(evt);
|
const copyEvent = cloneDeep(evt);
|
||||||
copyEvent.uid = booking.uid;
|
copyEvent.uid = booking.uid;
|
||||||
await sendScheduledSeatsEmails(copyEvent, invitee[0], newSeat, !!eventType.seatsShowAttendees);
|
if (noEmail !== true) {
|
||||||
|
let isHostConfirmationEmailsDisabled = false;
|
||||||
|
let isAttendeeConfirmationEmailDisabled = false;
|
||||||
|
|
||||||
|
const workflows = eventType.workflows.map((workflow) => workflow.workflow);
|
||||||
|
|
||||||
|
if (eventType.workflows) {
|
||||||
|
isHostConfirmationEmailsDisabled =
|
||||||
|
eventType.metadata?.disableStandardEmails?.confirmation?.host || false;
|
||||||
|
isAttendeeConfirmationEmailDisabled =
|
||||||
|
eventType.metadata?.disableStandardEmails?.confirmation?.attendee || false;
|
||||||
|
|
||||||
|
if (isHostConfirmationEmailsDisabled) {
|
||||||
|
isHostConfirmationEmailsDisabled = allowDisablingHostConfirmationEmails(workflows);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAttendeeConfirmationEmailDisabled) {
|
||||||
|
isAttendeeConfirmationEmailDisabled = allowDisablingAttendeeConfirmationEmails(workflows);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await sendScheduledSeatsEmails(
|
||||||
|
copyEvent,
|
||||||
|
invitee[0],
|
||||||
|
newSeat,
|
||||||
|
!!eventType.seatsShowAttendees,
|
||||||
|
isHostConfirmationEmailsDisabled,
|
||||||
|
isAttendeeConfirmationEmailDisabled
|
||||||
|
);
|
||||||
|
}
|
||||||
const credentials = await refreshCredentials(allCredentials);
|
const credentials = await refreshCredentials(allCredentials);
|
||||||
const eventManager = new EventManager({ ...organizerUser, credentials });
|
const eventManager = new EventManager({ ...organizerUser, credentials });
|
||||||
await eventManager.updateCalendarAttendees(evt, booking);
|
await eventManager.updateCalendarAttendees(evt, booking);
|
||||||
|
|
Loading…
Reference in New Issue