fix: Function sendScheduledSeatsEmails ignore rule 'Disable default confirmation emails for attendees' (#11722)

This commit is contained in:
Siddharth Movaliya authored and GitHub committed 2023-10-12 16:57:35 +02:00
1 parent 20803451de
commit 8ebcfbb8d1
2 files changed
+40 -8

No files matched your search

+12 -7
View File
@@ -135,20 +135,25 @@ export const sendScheduledSeatsEmails = async (
calEvent: CalendarEvent,
invitee: Person,
newSeat: boolean,
showAttendees: boolean
showAttendees: boolean,
hostEmailDisabled?: boolean,
attendeeEmailDisabled?: boolean
) => {
const emailsToSend: Promise<unknown>[] = [];
emailsToSend.push(sendEmail(() => new OrganizerScheduledEmail({ calEvent, newSeat })));
if (!hostEmailDisabled) {
emailsToSend.push(sendEmail(() => new OrganizerScheduledEmail({ calEvent, newSeat })));
if (calEvent.team) {
for (const teamMember of calEvent.team.members) {
emailsToSend.push(sendEmail(() => new OrganizerScheduledEmail({ calEvent, newSeat, teamMember })));
if (calEvent.team) {
for (const teamMember of calEvent.team.members) {
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);
};