Scheduling infrastructure for absolutely everyone.
fixed attendee language per attendee (#1694)
Syed Ali Shahbazc709f9ed1bc8
diff --git a/lib/emails/templates/attendee-awaiting-payment-email.ts b/lib/emails/templates/attendee-awaiting-payment-email.tsindex 7455ecfdf09..9cf8823e401 100644--- a/lib/emails/templates/attendee-awaiting-payment-email.ts+++ b/lib/emails/templates/attendee-awaiting-payment-email.ts@@ -25,14 +25,14 @@ export default class AttendeeAwaitingPaymentEmail extends AttendeeScheduledEmailto: `${this.attendee.name} <${this.attendee.email}>`,from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,replyTo: this.calEvent.organizer.email,- subject: `${this.calEvent.attendees[0].language.translate("awaiting_payment_subject", {+ subject: `${this.attendee.language.translate("awaiting_payment_subject", {eventType: this.calEvent.type,name: this.calEvent.team?.name || this.calEvent.organizer.name,date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format("h:mma"- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("dddd").toLowerCase()- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("MMMM").toLowerCase())} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,})}`,@@ -43,8 +43,8 @@ export default class AttendeeAwaitingPaymentEmail extends AttendeeScheduledEmailprotected getTextBody(): string {return `-${this.calEvent.attendees[0].language.translate("meeting_awaiting_payment")}-${this.calEvent.attendees[0].language.translate("emailed_you_and_any_other_attendees")}+${this.attendee.language.translate("meeting_awaiting_payment")}+${this.attendee.language.translate("emailed_you_and_any_other_attendees")}${this.getWhat()}${this.getWhen()}${this.getLocation()}@@ -53,14 +53,14 @@ ${this.getAdditionalNotes()}}protected getHtmlBody(): string {- const headerContent = this.calEvent.attendees[0].language.translate("awaiting_payment_subject", {+ const headerContent = this.attendee.language.translate("awaiting_payment_subject", {eventType: this.calEvent.type,name: this.calEvent.team?.name || this.calEvent.organizer.name,date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format("h:mma"- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("dddd").toLowerCase()- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("MMMM").toLowerCase())} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,});@@ -73,8 +73,8 @@ ${this.getAdditionalNotes()}<div style="background-color:#F5F5F5;">${emailSchedulingBodyHeader("calendarCircle")}${emailScheduledBodyHeaderContent(- this.calEvent.attendees[0].language.translate("meeting_awaiting_payment"),- this.calEvent.attendees[0].language.translate("emailed_you_and_any_other_attendees")+ this.attendee.language.translate("meeting_awaiting_payment"),+ this.attendee.language.translate("emailed_you_and_any_other_attendees"))}${emailSchedulingBodyDivider()}<!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->@@ -148,7 +148,7 @@ ${this.getAdditionalNotes()}}protected getManageLink(): string {- const manageText = this.calEvent.attendees[0].language.translate("pay_now");+ const manageText = this.attendee.language.translate("pay_now");if (this.calEvent.paymentInfo) {return `diff --git a/lib/emails/templates/attendee-cancelled-email.ts b/lib/emails/templates/attendee-cancelled-email.tsindex 25762e244f1..477ec5e4e36 100644--- a/lib/emails/templates/attendee-cancelled-email.ts+++ b/lib/emails/templates/attendee-cancelled-email.ts@@ -24,14 +24,14 @@ export default class AttendeeCancelledEmail extends AttendeeScheduledEmail {to: `${this.attendee.name} <${this.attendee.email}>`,from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,replyTo: this.calEvent.organizer.email,- subject: `${this.calEvent.attendees[0].language.translate("event_cancelled_subject", {+ subject: `${this.attendee.language.translate("event_cancelled_subject", {eventType: this.calEvent.type,name: this.calEvent.team?.name || this.calEvent.organizer.name,date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format("h:mma"- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("dddd").toLowerCase()- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("MMMM").toLowerCase())} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,})}`,@@ -42,8 +42,8 @@ export default class AttendeeCancelledEmail extends AttendeeScheduledEmail {protected getTextBody(): string {return `-${this.calEvent.attendees[0].language.translate("event_request_cancelled")}-${this.calEvent.attendees[0].language.translate("emailed_you_and_any_other_attendees")}+${this.attendee.language.translate("event_request_cancelled")}+${this.attendee.language.translate("emailed_you_and_any_other_attendees")}${this.getWhat()}${this.getWhen()}${this.getLocation()}@@ -53,14 +53,14 @@ ${this.calEvent.cancellationReason && this.getCancellationReason()}}protected getHtmlBody(): string {- const headerContent = this.calEvent.attendees[0].language.translate("event_cancelled_subject", {+ const headerContent = this.attendee.language.translate("event_cancelled_subject", {eventType: this.calEvent.type,name: this.calEvent.team?.name || this.calEvent.organizer.name,date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format("h:mma"- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("dddd").toLowerCase()- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("MMMM").toLowerCase())} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,});@@ -74,8 +74,8 @@ ${this.calEvent.cancellationReason && this.getCancellationReason()}<div style="background-color:#F5F5F5;">${emailSchedulingBodyHeader("xCircle")}${emailScheduledBodyHeaderContent(- this.calEvent.attendees[0].language.translate("event_request_cancelled"),- this.calEvent.attendees[0].language.translate("emailed_you_and_any_other_attendees")+ this.attendee.language.translate("event_request_cancelled"),+ this.attendee.language.translate("emailed_you_and_any_other_attendees"))}${emailSchedulingBodyDivider()}<!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->@@ -133,7 +133,7 @@ ${this.calEvent.cancellationReason && this.getCancellationReason()}return `<p style="height: 6px"></p><div style="line-height: 6px;">- <p style="color: #494949;">${this.calEvent.attendees[0].language.translate("cancellation_reason")}</p>+ <p style="color: #494949;">${this.attendee.language.translate("cancellation_reason")}</p><p style="color: #494949; font-weight: 400; line-height: 24px;">${this.calEvent.cancellationReason}</p></div>`;}diff --git a/lib/emails/templates/attendee-declined-email.ts b/lib/emails/templates/attendee-declined-email.tsindex 32c920e6f2d..1665e50b10e 100644--- a/lib/emails/templates/attendee-declined-email.ts+++ b/lib/emails/templates/attendee-declined-email.ts@@ -24,14 +24,14 @@ export default class AttendeeDeclinedEmail extends AttendeeScheduledEmail {to: `${this.attendee.name} <${this.attendee.email}>`,from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,replyTo: this.calEvent.organizer.email,- subject: `${this.calEvent.attendees[0].language.translate("event_declined_subject", {+ subject: `${this.attendee.language.translate("event_declined_subject", {eventType: this.calEvent.type,name: this.calEvent.team?.name || this.calEvent.organizer.name,date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format("h:mma"- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("dddd").toLowerCase()- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("MMMM").toLowerCase())} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,})}`,@@ -42,8 +42,8 @@ export default class AttendeeDeclinedEmail extends AttendeeScheduledEmail {protected getTextBody(): string {return `-${this.calEvent.attendees[0].language.translate("event_request_declined")}-${this.calEvent.attendees[0].language.translate("emailed_you_and_any_other_attendees")}+${this.attendee.language.translate("event_request_declined")}+${this.attendee.language.translate("emailed_you_and_any_other_attendees")}${this.getWhat()}${this.getWhen()}${this.getLocation()}@@ -52,14 +52,14 @@ ${this.getAdditionalNotes()}}protected getHtmlBody(): string {- const headerContent = this.calEvent.attendees[0].language.translate("event_declined_subject", {+ const headerContent = this.attendee.language.translate("event_declined_subject", {eventType: this.calEvent.type,name: this.calEvent.team?.name || this.calEvent.organizer.name,date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format("h:mma"- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("dddd").toLowerCase()- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("MMMM").toLowerCase())} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,});@@ -73,8 +73,8 @@ ${this.getAdditionalNotes()}<div style="background-color:#F5F5F5;">${emailSchedulingBodyHeader("xCircle")}${emailScheduledBodyHeaderContent(- this.calEvent.attendees[0].language.translate("event_request_declined"),- this.calEvent.attendees[0].language.translate("emailed_you_and_any_other_attendees")+ this.attendee.language.translate("event_request_declined"),+ this.attendee.language.translate("emailed_you_and_any_other_attendees"))}${emailSchedulingBodyDivider()}<!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->diff --git a/lib/emails/templates/attendee-rescheduled-email.ts b/lib/emails/templates/attendee-rescheduled-email.tsindex bf5e7d549b1..cd50e058204 100644--- a/lib/emails/templates/attendee-rescheduled-email.ts+++ b/lib/emails/templates/attendee-rescheduled-email.ts@@ -30,14 +30,14 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {to: `${this.attendee.name} <${this.attendee.email}>`,from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,replyTo: this.calEvent.organizer.email,- subject: `${this.calEvent.attendees[0].language.translate("rescheduled_event_type_subject", {+ subject: `${this.attendee.language.translate("rescheduled_event_type_subject", {eventType: this.calEvent.type,name: this.calEvent.team?.name || this.calEvent.organizer.name,date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format("h:mma"- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("dddd").toLowerCase()- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("MMMM").toLowerCase())} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,})}`,@@ -51,20 +51,20 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {// Guests cannotif (this.attendee === this.calEvent.attendees[0]) {return `- ${this.calEvent.attendees[0].language.translate("event_has_been_rescheduled")}- ${this.calEvent.attendees[0].language.translate("emailed_you_and_any_other_attendees")}+ ${this.attendee.language.translate("event_has_been_rescheduled")}+ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")}${this.getWhat()}${this.getWhen()}${this.getLocation()}${this.getAdditionalNotes()}- ${this.calEvent.attendees[0].language.translate("need_to_reschedule_or_cancel")}+ ${this.attendee.language.translate("need_to_reschedule_or_cancel")}${getCancelLink(this.calEvent)}`.replace(/(<([^>]+)>)/gi, "");}return `-${this.calEvent.attendees[0].language.translate("event_has_been_rescheduled")}-${this.calEvent.attendees[0].language.translate("emailed_you_and_any_other_attendees")}+${this.attendee.language.translate("event_has_been_rescheduled")}+${this.attendee.language.translate("emailed_you_and_any_other_attendees")}${this.getWhat()}${this.getWhen()}${this.getLocation()}@@ -73,14 +73,14 @@ ${this.getAdditionalNotes()}}protected getHtmlBody(): string {- const headerContent = this.calEvent.attendees[0].language.translate("rescheduled_event_type_subject", {+ const headerContent = this.attendee.language.translate("rescheduled_event_type_subject", {eventType: this.calEvent.type,name: this.calEvent.team?.name || this.calEvent.organizer.name,date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format("h:mma"- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("dddd").toLowerCase()- )}, ${this.calEvent.attendees[0].language.translate(+ )}, ${this.attendee.language.translate(this.getInviteeStart().format("MMMM").toLowerCase())} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,});@@ -93,8 +93,8 @@ ${this.getAdditionalNotes()}<div style="background-color:#F5F5F5;">${emailSchedulingBodyHeader("calendarCircle")}${emailScheduledBodyHeaderContent(- this.calEvent.attendees[0].language.translate("event_has_been_rescheduled"),- this.calEvent.attendees[0].language.translate("emailed_you_and_any_other_attendees")+ this.attendee.language.translate("event_has_been_rescheduled"),+ this.attendee.language.translate("emailed_you_and_any_other_attendees"))}${emailSchedulingBodyDivider()}<!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->diff --git a/lib/emails/templates/attendee-scheduled-email.ts b/lib/emails/templates/attendee-scheduled-email.tsindex 2ce4a0a0b05..494ed452b79 100644--- a/lib/emails/templates/attendee-scheduled-email.ts+++ b/lib/emails/templates/attendee-scheduled-email.ts@@ -3,13 +3,13 @@ import localizedFormat from "dayjs/plugin/localizedFormat";import timezone from "dayjs/plugin/timezone";import toArray from "dayjs/plugin/toArray";import utc from "dayjs/plugin/utc";-import { createEvent, DateArray, Person } from "ics";+import { createEvent, DateArray } from "ics";import nodemailer from "nodemailer";import { getCancelLink, getRichDescription } from "@lib/CalEventParser";import { getErrorFromUnknown } from "@lib/errors";import { getIntegrationName } from "@lib/integrations";-import { CalendarEvent } from "@lib/integrations/calendar/interfaces/Calendar";+import { CalendarEvent, Person } from "@lib/integrations/calendar/interfaces/Calendar";import { serverConfig } from "@lib/serverConfig";import {