From dfb1b5602d8c2a07e77c0e261e455507c263082f Mon Sep 17 00:00:00 2001 From: Mihai C <34626017+mihaic195@users.noreply.github.com> Date: Thu, 18 Nov 2021 13:13:38 +0200 Subject: [PATCH] hotfix: location on approval email (#1186) * hotfix: location on confirmation email * fix: build checks --- lib/emails/EventAttendeeMail.ts | 37 +++++++++++++++++++++++--------- lib/emails/EventOrganizerMail.ts | 35 ++++++++++++++++++++++-------- lib/events/EventManager.ts | 6 +++--- lib/videoClient.ts | 9 -------- 4 files changed, 56 insertions(+), 31 deletions(-) diff --git a/lib/emails/EventAttendeeMail.ts b/lib/emails/EventAttendeeMail.ts index 2058e6ea..299a0bfd 100644 --- a/lib/emails/EventAttendeeMail.ts +++ b/lib/emails/EventAttendeeMail.ts @@ -75,10 +75,7 @@ export default class EventAttendeeMail extends EventMail { - - ${this.calEvent.language("where")} - ${this.getLocation()} - + ${this.getLocation()} ${this.calEvent.language("notes")} ${this.calEvent.description} @@ -107,7 +104,13 @@ export default class EventAttendeeMail extends EventMail { */ protected getLocation(): string { if (this.calEvent.additionInformation?.hangoutLink) { - return `${this.calEvent.additionInformation?.hangoutLink}
`; + return ` + ${this.calEvent.language("where")} + ${ + this.calEvent.additionInformation?.hangoutLink + }
+ + `; } if ( @@ -117,16 +120,30 @@ export default class EventAttendeeMail extends EventMail { const locations = this.calEvent.additionInformation?.entryPoints .map((entryPoint) => { return ` - ${this.calEvent.language("join_by_entrypoint", { entryPoint: entryPoint.entryPointType })}:
- ${entryPoint.label}
- `; + ${this.calEvent.language("join_by_entrypoint", { entryPoint: entryPoint.entryPointType })}:
+ ${entryPoint.label}
+ `; }) .join("
"); - return `${locations}`; + return ` + ${this.calEvent.language("where")} + ${locations} + + `; } - return this.calEvent.location ? `${this.calEvent.location}

` : ""; + if (!this.calEvent.location) { + return ``; + } + + if (this.calEvent.location === "integrations:zoom" || this.calEvent.location === "integrations:daily") { + return ``; + } + + return `${this.calEvent.language("where")}${ + this.calEvent.location + }

`; } protected getAdditionalBody(): string { diff --git a/lib/emails/EventOrganizerMail.ts b/lib/emails/EventOrganizerMail.ts index a08e40f6..f8bb78db 100644 --- a/lib/emails/EventOrganizerMail.ts +++ b/lib/emails/EventOrganizerMail.ts @@ -3,7 +3,7 @@ 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 } from "ics"; +import { createEvent, DateArray } from "ics"; import { Person } from "@lib/calendarClient"; @@ -26,7 +26,7 @@ export default class EventOrganizerMail extends EventMail { .utc() .toArray() .slice(0, 6) - .map((v, i) => (i === 1 ? v + 1 : v)), + .map((v, i) => (i === 1 ? v + 1 : v)) as DateArray, startInputType: "utc", productId: "calendso/ics", title: this.calEvent.language("organizer_ics_event_title", { @@ -125,10 +125,7 @@ export default class EventOrganizerMail extends EventMail { this.calEvent.attendees[0].email }">${this.calEvent.attendees[0].email} - - ${this.calEvent.language("where")} - ${this.getLocation()} - + ${this.getLocation()} ${this.calEvent.language("notes")} ${this.calEvent.description} @@ -157,7 +154,13 @@ export default class EventOrganizerMail extends EventMail { */ protected getLocation(): string { if (this.calEvent.additionInformation?.hangoutLink) { - return `${this.calEvent.additionInformation?.hangoutLink}
`; + return ` + ${this.calEvent.language("where")} + ${ + this.calEvent.additionInformation?.hangoutLink + }
+ + `; } if ( @@ -173,10 +176,24 @@ export default class EventOrganizerMail extends EventMail { }) .join("
"); - return `${locations}`; + return ` + ${this.calEvent.language("where")} + ${locations} + + `; } - return this.calEvent.location ? `${this.calEvent.location}

` : ""; + if (!this.calEvent.location) { + return ``; + } + + if (this.calEvent.location === "integrations:zoom" || this.calEvent.location === "integrations:daily") { + return ``; + } + + return `${this.calEvent.language("where")}${ + this.calEvent.location + }

`; } protected getAdditionalBody(): string { diff --git a/lib/events/EventManager.ts b/lib/events/EventManager.ts index e2229f13..9af5153d 100644 --- a/lib/events/EventManager.ts +++ b/lib/events/EventManager.ts @@ -399,9 +399,9 @@ export default class EventManager { // future, it might happen that we consider making passwords for Zoom meetings optional. // Then, this part below (where the password existence is checked) needs to be adapted. isComplete = - reference.meetingId != undefined && - reference.meetingPassword != undefined && - reference.meetingUrl != undefined; + reference.meetingId !== undefined && + reference.meetingPassword !== undefined && + reference.meetingUrl !== undefined; break; default: isComplete = true; diff --git a/lib/videoClient.ts b/lib/videoClient.ts index 647a663f..576ee6a8 100644 --- a/lib/videoClient.ts +++ b/lib/videoClient.ts @@ -170,15 +170,6 @@ const updateMeeting = async ( }) : undefined; - if (!updatedMeeting) { - return { - type: credential.type, - success, - uid, - originalEvent: calEvent, - }; - } - try { const organizerMail = new EventOrganizerRescheduledMail(calEvent); await organizerMail.sendEmail();