Scheduling infrastructure for absolutely everyone.
Show eventDescription on email (#2371)
sean-brydon96f6294542bc
diff --git a/apps/web/lib/emails/templates/attendee-awaiting-payment-email.ts b/apps/web/lib/emails/templates/attendee-awaiting-payment-email.tsindex 9cf8823e401..27fe50d614c 100644--- a/apps/web/lib/emails/templates/attendee-awaiting-payment-email.ts+++ b/apps/web/lib/emails/templates/attendee-awaiting-payment-email.ts@@ -48,6 +48,7 @@ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")}${this.getWhat()}${this.getWhen()}${this.getLocation()}+${this.getDescription()}${this.getAdditionalNotes()}`.replace(/(<([^>]+)>)/gi, "");}@@ -94,6 +95,7 @@ ${this.getAdditionalNotes()}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}</div></td>diff --git a/apps/web/lib/emails/templates/attendee-cancelled-email.ts b/apps/web/lib/emails/templates/attendee-cancelled-email.tsindex 477ec5e4e36..d356beafba1 100644--- a/apps/web/lib/emails/templates/attendee-cancelled-email.ts+++ b/apps/web/lib/emails/templates/attendee-cancelled-email.ts@@ -47,6 +47,7 @@ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")}${this.getWhat()}${this.getWhen()}${this.getLocation()}+${this.getDescription()}${this.getAdditionalNotes()}${this.calEvent.cancellationReason && this.getCancellationReason()}`.replace(/(<([^>]+)>)/gi, "");@@ -95,6 +96,7 @@ ${this.calEvent.cancellationReason && this.getCancellationReason()}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}${this.calEvent.cancellationReason && this.getCancellationReason()}</div>diff --git a/apps/web/lib/emails/templates/attendee-declined-email.ts b/apps/web/lib/emails/templates/attendee-declined-email.tsindex c27c3605101..b1e36496602 100644--- a/apps/web/lib/emails/templates/attendee-declined-email.ts+++ b/apps/web/lib/emails/templates/attendee-declined-email.ts@@ -47,6 +47,7 @@ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")}${this.getWhat()}${this.getWhen()}${this.getLocation()}+${this.getDescription()}${this.getAdditionalNotes()}${this.getRejectionReason()}`.replace(/(<([^>]+)>)/gi, "");@@ -95,6 +96,7 @@ ${this.getRejectionReason()}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}${this.getRejectionReason()}</div>diff --git a/apps/web/lib/emails/templates/attendee-request-email.ts b/apps/web/lib/emails/templates/attendee-request-email.tsindex 921b5d34561..98dec12bf74 100644--- a/apps/web/lib/emails/templates/attendee-request-email.ts+++ b/apps/web/lib/emails/templates/attendee-request-email.ts@@ -60,6 +60,7 @@ ${this.calEvent.attendees[0].language.translate("user_needs_to_confirm_or_reject${this.getWhat()}${this.getWhen()}${this.getLocation()}+${this.getDescription()}${this.getAdditionalNotes()}`.replace(/(<([^>]+)>)/gi, "");}@@ -109,6 +110,7 @@ ${this.getAdditionalNotes()}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}</div></td>diff --git a/apps/web/lib/emails/templates/attendee-rescheduled-email.ts b/apps/web/lib/emails/templates/attendee-rescheduled-email.tsindex 46bf6364cca..d232cf99064 100644--- a/apps/web/lib/emails/templates/attendee-rescheduled-email.ts+++ b/apps/web/lib/emails/templates/attendee-rescheduled-email.ts@@ -45,7 +45,6 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {text: this.getTextBody(),};}-protected getTextBody(): string {// Only the original attendee can make changes to the event// Guests cannot@@ -56,6 +55,7 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {${this.getWhat()}${this.getWhen()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}${this.attendee.language.translate("need_to_reschedule_or_cancel")}${getCancelLink(this.calEvent)}@@ -114,6 +114,7 @@ ${this.getAdditionalNotes()}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}</div></td>diff --git a/apps/web/lib/emails/templates/attendee-scheduled-email.ts b/apps/web/lib/emails/templates/attendee-scheduled-email.tsindex 9f8cd49eb40..22730dc067e 100644--- a/apps/web/lib/emails/templates/attendee-scheduled-email.ts+++ b/apps/web/lib/emails/templates/attendee-scheduled-email.ts@@ -112,7 +112,18 @@ export default class AttendeeScheduledEmail {from: serverConfig.from,};}-+ protected getDescription(): string {+ if (!this.calEvent.description) return "";+ return `+ <p style="height: 6px"></p>+ <div style="line-height: 6px;">+ <p style="color: #494949;">${this.calEvent.organizer.language.translate("description")}</p>+ <p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${+ this.calEvent.description+ }</p>+ </div>+ `;+ }protected getTextBody(): string {return `${this.calEvent.attendees[0].language.translate("your_event_has_been_scheduled")}@@ -168,6 +179,7 @@ ${getRichDescription(this.calEvent)}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}</div></td>@@ -286,13 +298,13 @@ ${getRichDescription(this.calEvent)}}protected getAdditionalNotes(): string {- if (!this.calEvent.description) return "";+ if (!this.calEvent.additionalNotes) return "";return `<p style="height: 6px"></p><div style="line-height: 6px;"><p style="color: #494949;">${this.calEvent.attendees[0].language.translate("additional_notes")}</p><p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${- this.calEvent.description+ this.calEvent.additionalNotes}</p></div>`;diff --git a/apps/web/lib/emails/templates/organizer-cancelled-email.ts b/apps/web/lib/emails/templates/organizer-cancelled-email.tsindex 639e4a8fa22..7f7c6bb5ad7 100644--- a/apps/web/lib/emails/templates/organizer-cancelled-email.ts+++ b/apps/web/lib/emails/templates/organizer-cancelled-email.ts@@ -56,6 +56,7 @@ ${this.calEvent.organizer.language.translate("emailed_you_and_any_other_attendee${this.getWhat()}${this.getWhen()}${this.getLocation()}+${this.getDescription()}${this.getAdditionalNotes()}${this.calEvent.cancellationReason && this.getCancellationReason()}`.replace(/(<([^>]+)>)/gi, "");@@ -103,6 +104,7 @@ ${this.calEvent.cancellationReason && this.getCancellationReason()}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}${this.calEvent.cancellationReason && this.getCancellationReason()}</div>diff --git a/apps/web/lib/emails/templates/organizer-payment-refund-failed-email.ts b/apps/web/lib/emails/templates/organizer-payment-refund-failed-email.tsindex 6b254980e76..40f4b524e7b 100644--- a/apps/web/lib/emails/templates/organizer-payment-refund-failed-email.ts+++ b/apps/web/lib/emails/templates/organizer-payment-refund-failed-email.ts@@ -58,6 +58,7 @@ ${${this.getWhat()}${this.getWhen()}${this.getLocation()}+${this.getDescription()}${this.getAdditionalNotes()}`.replace(/(<([^>]+)>)/gi, "");}@@ -136,6 +137,7 @@ ${this.getAdditionalNotes()}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}</div></td>diff --git a/apps/web/lib/emails/templates/organizer-request-email.ts b/apps/web/lib/emails/templates/organizer-request-email.tsindex 58278930339..b945932919c 100644--- a/apps/web/lib/emails/templates/organizer-request-email.ts+++ b/apps/web/lib/emails/templates/organizer-request-email.ts@@ -57,6 +57,7 @@ ${this.calEvent.organizer.language.translate("someone_requested_an_event")}${this.getWhat()}${this.getWhen()}${this.getLocation()}+${this.getDescription()}${this.getAdditionalNotes()}${this.calEvent.organizer.language.translate("confirm_or_reject_request")}${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"diff --git a/apps/web/lib/emails/templates/organizer-request-reminder-email.ts b/apps/web/lib/emails/templates/organizer-request-reminder-email.tsindex 50ab1e806cc..bc3acc7c086 100644--- a/apps/web/lib/emails/templates/organizer-request-reminder-email.ts+++ b/apps/web/lib/emails/templates/organizer-request-reminder-email.ts@@ -57,6 +57,7 @@ ${this.calEvent.organizer.language.translate("someone_requested_an_event")}${this.getWhat()}${this.getWhen()}${this.getLocation()}+${this.getDescription()}${this.getAdditionalNotes()}${this.calEvent.organizer.language.translate("confirm_or_reject_request")}${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"@@ -105,6 +106,7 @@ ${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming"${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}</div></td>diff --git a/apps/web/lib/emails/templates/organizer-rescheduled-email.ts b/apps/web/lib/emails/templates/organizer-rescheduled-email.tsindex 5c9a7e5c4d6..dd371c8cd40 100644--- a/apps/web/lib/emails/templates/organizer-rescheduled-email.ts+++ b/apps/web/lib/emails/templates/organizer-rescheduled-email.ts@@ -62,6 +62,7 @@ ${this.calEvent.organizer.language.translate("emailed_you_and_any_other_attendee${this.getWhat()}${this.getWhen()}${this.getLocation()}+${this.getDescription()}${this.getAdditionalNotes()}${this.calEvent.organizer.language.translate("need_to_reschedule_or_cancel")}${getCancelLink(this.calEvent)}@@ -110,6 +111,7 @@ ${getCancelLink(this.calEvent)}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}</div></td>diff --git a/apps/web/lib/emails/templates/organizer-scheduled-email.ts b/apps/web/lib/emails/templates/organizer-scheduled-email.tsindex 2fd3889625f..35828360509 100644--- a/apps/web/lib/emails/templates/organizer-scheduled-email.ts+++ b/apps/web/lib/emails/templates/organizer-scheduled-email.ts@@ -175,6 +175,7 @@ ${getRichDescription(this.calEvent)}${this.getWhen()}${this.getWho()}${this.getLocation()}+ ${this.getDescription()}${this.getAdditionalNotes()}</div></td>@@ -287,11 +288,24 @@ ${getRichDescription(this.calEvent)}}protected getAdditionalNotes(): string {- if (!this.calEvent.description) return "";+ if (!this.calEvent.additionalNotes) return "";return `<p style="height: 6px"></p><div style="line-height: 6px;"><p style="color: #494949;">${this.calEvent.organizer.language.translate("additional_notes")}</p>+ <p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${+ this.calEvent.additionalNotes+ }</p>+ </div>+ `;+ }++ protected getDescription(): string {+ if (!this.calEvent.description) return "";+ return `+ <p style="height: 6px"></p>+ <div style="line-height: 6px;">+ <p style="color: #494949;">${this.calEvent.organizer.language.translate("description")}</p><p style="color: #494949; font-weight: 400; line-height: 24px; white-space: pre-wrap;">${this.calEvent.description}</p>diff --git a/apps/web/pages/api/book/event.ts b/apps/web/pages/api/book/event.tsindex eed093b996f..87d2c9f98f7 100644--- a/apps/web/pages/api/book/event.ts+++ b/apps/web/pages/api/book/event.ts@@ -200,6 +200,7 @@ const getEventTypesFromDB = async (eventTypeId: number) => {length: true,eventName: true,schedulingType: true,+ description: true,periodType: true,periodStartDate: true,periodEndDate: true,@@ -337,7 +338,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)t: tOrganizer,};- const description =+ const additionalNotes =reqBody.notes +reqBody.customInputs.reduce((str, input) => str + "<br /><br />" + input.label + ":<br />" + input.value,@@ -346,7 +347,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)const evt: CalendarEvent = {type: eventType.title,title: getEventName(eventNameObject), //this needs to be either forced in english, or fetched for each attendee and organizer separately- description,+ description: eventType.description,+ additionalNotes,startTime: reqBody.start,endTime: reqBody.end,organizer: {@@ -402,7 +404,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)title: evt.title,startTime: dayjs(evt.startTime).toDate(),endTime: dayjs(evt.endTime).toDate(),- description: evt.description,+ description: evt.additionalNotes,confirmed: (!eventType.requiresConfirmation && !eventType.price) || !!rescheduleUid,location: evt.location,eventType: eventTypeRel,@@ -557,7 +559,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)const updateManager = await eventManager.update(evt, rescheduleUid);// This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back// to the default description when we are sending the emails.- evt.description = description;+ evt.description = eventType.description;results = updateManager.results;referencesToCreate = updateManager.referencesToCreate;@@ -594,7 +596,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)// This gets overridden when creating the event - to check if notes have been hidden or not. We just reset this back// to the default description when we are sending the emails.- evt.description = description;+ evt.description = eventType.description;results = createManager.results;referencesToCreate = createManager.referencesToCreate;diff --git a/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt b/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txtindex 51471113be7..2d8e6d92036 100644--- a/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt+++ b/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt@@ -1 +1 @@-{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"[email protected]","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"[email protected]","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}\ No newline at end of file+{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":null,"additionalNotes":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"[email protected]","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"[email protected]","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}\ No newline at end of filediff --git a/packages/core/CalendarManager.ts b/packages/core/CalendarManager.tsindex 5d387429bc7..726fb56cab9 100644--- a/packages/core/CalendarManager.ts+++ b/packages/core/CalendarManager.ts@@ -104,7 +104,7 @@ export const createEvent = async (credential: Credential, calEvent: CalendarEven// Check if the disabledNotes flag is set to trueif (calEvent.hideCalendarNotes) {- calEvent.description = "Notes have been hidden by the organiser"; // TODO: i18n this string?+ calEvent.additionalNotes = "Notes have been hidden by the organiser"; // TODO: i18n this string?}const creationResult = calendardiff --git a/packages/lib/CalEventParser.ts b/packages/lib/CalEventParser.tsindex 2cb39deb1e9..888a3748cac 100644--- a/packages/lib/CalEventParser.ts+++ b/packages/lib/CalEventParser.ts@@ -48,10 +48,15 @@ ${organizer + attendees}export const getAdditionalNotes = (calEvent: CalendarEvent) => {return `${calEvent.organizer.language.translate("additional_notes")}:-${calEvent.description}+${calEvent.additionalNotes}`;};+export const getDescription = (calEvent: CalendarEvent) => {+ return `\n${calEvent.attendees[0].language.translate("description")}+ ${calEvent.description}+ `;+};export const getLocation = (calEvent: CalendarEvent) => {let providerName = "";@@ -97,6 +102,7 @@ ${getWhen(calEvent)}${getWho(calEvent)}${calEvent.organizer.language.translate("where")}:${getLocation(calEvent)}+${getDescription(calEvent)}${getAdditionalNotes(calEvent)}`.trim();}@@ -107,6 +113,7 @@ ${getWhen(calEvent)}${getWho(calEvent)}${calEvent.organizer.language.translate("where")}:${getLocation(calEvent)}+${getDescription(calEvent)}${getAdditionalNotes(calEvent)}${getManageLink(calEvent)}`.trim();diff --git a/packages/types/Calendar.d.ts b/packages/types/Calendar.d.tsindex 0708eb3f317..00b9ab3f884 100644--- a/packages/types/Calendar.d.ts+++ b/packages/types/Calendar.d.ts@@ -75,6 +75,7 @@ export interface CalendarEvent {title: string;startTime: string;endTime: string;+ additionalNotes?: string | null;description?: string | null;team?: {name: string;