feat: translate attendee scheduled email in bookers locale (#7654)
parent
d50473468a
commit
e24f1d8bdb
|
@ -1,5 +1,7 @@
|
||||||
import type { TFunction } from "next-i18next";
|
import type { TFunction } from "next-i18next";
|
||||||
|
|
||||||
|
import type { EventNameObjectType } from "@calcom/core/event";
|
||||||
|
import { getEventName } from "@calcom/core/event";
|
||||||
import type BaseEmail from "@calcom/emails/templates/_base-email";
|
import type BaseEmail from "@calcom/emails/templates/_base-email";
|
||||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
|
@ -39,7 +41,7 @@ const sendEmail = (prepare: () => BaseEmail) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sendScheduledEmails = async (calEvent: CalendarEvent) => {
|
export const sendScheduledEmails = async (calEvent: CalendarEvent, eventNameObject?: EventNameObjectType) => {
|
||||||
const emailsToSend: Promise<unknown>[] = [];
|
const emailsToSend: Promise<unknown>[] = [];
|
||||||
|
|
||||||
emailsToSend.push(sendEmail(() => new OrganizerScheduledEmail({ calEvent })));
|
emailsToSend.push(sendEmail(() => new OrganizerScheduledEmail({ calEvent })));
|
||||||
|
@ -52,7 +54,18 @@ export const sendScheduledEmails = async (calEvent: CalendarEvent) => {
|
||||||
|
|
||||||
emailsToSend.push(
|
emailsToSend.push(
|
||||||
...calEvent.attendees.map((attendee) => {
|
...calEvent.attendees.map((attendee) => {
|
||||||
return sendEmail(() => new AttendeeScheduledEmail(calEvent, attendee));
|
return sendEmail(
|
||||||
|
() =>
|
||||||
|
new AttendeeScheduledEmail(
|
||||||
|
{
|
||||||
|
...calEvent,
|
||||||
|
...(eventNameObject && {
|
||||||
|
title: getEventName({ ...eventNameObject, t: attendee.language.translate }),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
attendee
|
||||||
|
)
|
||||||
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1267,12 +1267,15 @@ async function handler(
|
||||||
videoCallUrl = metadata.hangoutLink || defaultLocationUrl || videoCallUrl;
|
videoCallUrl = metadata.hangoutLink || defaultLocationUrl || videoCallUrl;
|
||||||
}
|
}
|
||||||
if (noEmail !== true) {
|
if (noEmail !== true) {
|
||||||
await sendScheduledEmails({
|
await sendScheduledEmails(
|
||||||
...evt,
|
{
|
||||||
additionalInformation: metadata,
|
...evt,
|
||||||
additionalNotes,
|
additionalInformation: metadata,
|
||||||
customInputs,
|
additionalNotes,
|
||||||
});
|
customInputs,
|
||||||
|
},
|
||||||
|
eventNameObject
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue