fixed attendee language per attendee (#1694)
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
		
							parent
							
								
									72d029d9f6
								
							
						
					
					
						commit
						c709f9ed1b
					
				
					 5 changed files with 47 additions and 47 deletions
				
			
		|  | @ -25,14 +25,14 @@ export default class AttendeeAwaitingPaymentEmail 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("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 AttendeeScheduledEmail | |||
| 
 | ||||
|   protected 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 ` | ||||
|  |  | |||
|  | @ -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>`;
 | ||||
|   } | ||||
|  |  | |||
|  | @ -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]--> | ||||
|  |  | |||
|  | @ -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 cannot
 | ||||
|     if (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]--> | ||||
|  |  | |||
|  | @ -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 { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Syed Ali Shahbaz
						Syed Ali Shahbaz