fix: organizer/attendee timezones in emails (#543)

This commit is contained in:
Mihai C 2021-09-01 23:39:24 +03:00 committed by GitHub
parent 8e9703545a
commit 1ab9d1797a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View file

@ -134,7 +134,7 @@ export default class EventAttendeeMail extends EventMail {
replyTo: this.calEvent.organizer.email, replyTo: this.calEvent.organizer.email,
subject: `Confirmed: ${this.calEvent.type} with ${ subject: `Confirmed: ${this.calEvent.type} with ${
this.calEvent.organizer.name this.calEvent.organizer.name
} on ${this.getInviteeStart().format("dddd, LL")}`, } on ${this.getInviteeStart().format("LT dddd, LL")}`,
html: this.getHtmlRepresentation(), html: this.getHtmlRepresentation(),
text: this.getPlainTextRepresentation(), text: this.getPlainTextRepresentation(),
}; };

View file

@ -107,8 +107,8 @@ export default class EventOrganizerMail extends EventMail {
</tr> </tr>
<tr> <tr>
<td>When</td> <td>When</td>
<td>${this.getInviteeStart().format("dddd, LL")}<br>${this.getInviteeStart().format("h:mma")} (${ <td>${this.getOrganizerStart().format("dddd, LL")}<br>${this.getOrganizerStart().format("h:mma")} (${
this.calEvent.attendees[0].timeZone this.calEvent.organizer.timeZone
})</td> })</td>
</tr> </tr>
<tr> <tr>
@ -191,10 +191,9 @@ export default class EventOrganizerMail extends EventMail {
} }
protected getSubject(): string { protected getSubject(): string {
const organizerStart: Dayjs = <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone); return `New event: ${this.calEvent.attendees[0].name} - ${this.getOrganizerStart().format(
return `New event: ${this.calEvent.attendees[0].name} - ${organizerStart.format("LT dddd, LL")} - ${ "LT dddd, LL"
this.calEvent.type )} - ${this.calEvent.type}`;
}`;
} }
protected printNodeMailerError(error: string): void { protected printNodeMailerError(error: string): void {
@ -202,11 +201,11 @@ export default class EventOrganizerMail extends EventMail {
} }
/** /**
* Returns the inviteeStart value used at multiple points. * Returns the organizerStart value used at multiple points.
* *
* @private * @private
*/ */
protected getInviteeStart(): Dayjs { protected getOrganizerStart(): Dayjs {
return <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.attendees[0].timeZone); return <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
} }
} }