Fix emails and cal event descriptions (#2634)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
alannnc 2022-04-28 09:05:29 -06:00 committed by GitHub
parent d960e03acf
commit 8e956893ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 10 deletions

View file

@ -174,14 +174,6 @@ const handler = async (
}
});
// Creating cancelled event as placeholders in calendars, remove when virtual calendar handles it
const eventManager = new EventManager({
credentials: userOwner.credentials,
destinationCalendar: userOwner.destinationCalendar,
});
builder.calendarEvent.title = `Cancelled: ${builder.calendarEvent.title}`;
await eventManager.updateAndSetCancelledPlaceholder(builder.calendarEvent, bookingToReschedule);
// Send emails
await sendRequestRescheduleEmail(builder.calendarEvent, {
rescheduleLink: builder.rescheduleLink,

View file

@ -101,8 +101,8 @@ export default function Type(props: inferSSRProps<typeof getServerSideProps>) {
className="mb-5 sm:mb-6"
/>
<div className="space-x-2 text-center rtl:space-x-reverse">
<Button color="secondary" onClick={() => router.back()}>
{t("back_to_bookings")}
<Button color="secondary" onClick={() => router.push("/reschedule/" + uid)}>
{t("reschedule_this")}
</Button>
<Button
data-testid="cancel"

View file

@ -5,6 +5,7 @@ import { v5 as uuidv5 } from "uuid";
import { getTranslation } from "@calcom/lib/server/i18n";
import prisma from "@calcom/prisma";
import { CalendarEvent } from "@calcom/types/Calendar";
import { CalendarEventClass } from "./class";
@ -124,6 +125,7 @@ export class CalendarEventBuilder implements ICalendarEventBuilder {
slug: true,
},
},
description: true,
slug: true,
teamId: true,
title: true,
@ -263,6 +265,10 @@ export class CalendarEventBuilder implements ICalendarEventBuilder {
this.calendarEvent.description = description;
}
public setNotes(notes: CalendarEvent["additionalNotes"]) {
this.calendarEvent.additionalNotes = notes;
}
public setCancellationReason(cancellationReason: CalendarEventClass["cancellationReason"]) {
this.calendarEvent.cancellationReason = cancellationReason;
}

View file

@ -21,6 +21,7 @@ class CalendarEventClass implements CalendarEvent {
cancellationReason?: string | null;
rejectionReason?: string | null;
hideCalendarNotes?: boolean;
additionalNotes?: string | null | undefined;
constructor(initProps?: CalendarEvent) {
// If more parameters are given we update this

View file

@ -27,6 +27,8 @@ export class CalendarEventDirector {
this.builder.setLocation(this.existingBooking.location);
this.builder.setUId(this.existingBooking.uid);
this.builder.setCancellationReason(this.cancellationReason);
this.builder.setDescription(this.builder.eventType.description);
this.builder.setNotes(this.existingBooking.description);
this.builder.buildRescheduleLink(this.existingBooking.uid);
} else {
throw new Error("buildForRescheduleEmail.missing.params.required");

View file

@ -46,6 +46,9 @@ ${organizer + attendees}
};
export const getAdditionalNotes = (calEvent: CalendarEvent) => {
if (!calEvent.additionalNotes) {
return "";
}
return `
${calEvent.organizer.language.translate("additional_notes")}:
${calEvent.additionalNotes}
@ -53,6 +56,9 @@ ${calEvent.additionalNotes}
};
export const getDescription = (calEvent: CalendarEvent) => {
if (!calEvent.description) {
return "";
}
return `\n${calEvent.attendees[0].language.translate("description")}
${calEvent.description}
`;