Fix emails and cal event descriptions (#2634)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
3256d601db
commit
d856ef53a7
6 files changed
+17
-10
No files matched your search
@@ -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
|
// Send emails
|
||||||
await sendRequestRescheduleEmail(builder.calendarEvent, {
|
await sendRequestRescheduleEmail(builder.calendarEvent, {
|
||||||
rescheduleLink: builder.rescheduleLink,
|
rescheduleLink: builder.rescheduleLink,
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ export default function Type(props: inferSSRProps<typeof getServerSideProps>) {
|
|||||||
className="mb-5 sm:mb-6"
|
className="mb-5 sm:mb-6"
|
||||||
/>
|
/>
|
||||||
<div className="space-x-2 text-center rtl:space-x-reverse">
|
<div className="space-x-2 text-center rtl:space-x-reverse">
|
||||||
<Button color="secondary" onClick={() => router.back()}>
|
<Button color="secondary" onClick={() => router.push("/reschedule/" + uid)}>
|
||||||
{t("back_to_bookings")}
|
{t("reschedule_this")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
data-testid="cancel"
|
data-testid="cancel"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { v5 as uuidv5 } from "uuid";
|
|||||||
|
|
||||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
|
import { CalendarEvent } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { CalendarEventClass } from "./class";
|
import { CalendarEventClass } from "./class";
|
||||||
|
|
||||||
@@ -124,6 +125,7 @@ export class CalendarEventBuilder implements ICalendarEventBuilder {
|
|||||||
slug: true,
|
slug: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
description: true,
|
||||||
slug: true,
|
slug: true,
|
||||||
teamId: true,
|
teamId: true,
|
||||||
title: true,
|
title: true,
|
||||||
@@ -263,6 +265,10 @@ export class CalendarEventBuilder implements ICalendarEventBuilder {
|
|||||||
this.calendarEvent.description = description;
|
this.calendarEvent.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setNotes(notes: CalendarEvent["additionalNotes"]) {
|
||||||
|
this.calendarEvent.additionalNotes = notes;
|
||||||
|
}
|
||||||
|
|
||||||
public setCancellationReason(cancellationReason: CalendarEventClass["cancellationReason"]) {
|
public setCancellationReason(cancellationReason: CalendarEventClass["cancellationReason"]) {
|
||||||
this.calendarEvent.cancellationReason = cancellationReason;
|
this.calendarEvent.cancellationReason = cancellationReason;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class CalendarEventClass implements CalendarEvent {
|
|||||||
cancellationReason?: string | null;
|
cancellationReason?: string | null;
|
||||||
rejectionReason?: string | null;
|
rejectionReason?: string | null;
|
||||||
hideCalendarNotes?: boolean;
|
hideCalendarNotes?: boolean;
|
||||||
|
additionalNotes?: string | null | undefined;
|
||||||
|
|
||||||
constructor(initProps?: CalendarEvent) {
|
constructor(initProps?: CalendarEvent) {
|
||||||
// If more parameters are given we update this
|
// If more parameters are given we update this
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ export class CalendarEventDirector {
|
|||||||
this.builder.setLocation(this.existingBooking.location);
|
this.builder.setLocation(this.existingBooking.location);
|
||||||
this.builder.setUId(this.existingBooking.uid);
|
this.builder.setUId(this.existingBooking.uid);
|
||||||
this.builder.setCancellationReason(this.cancellationReason);
|
this.builder.setCancellationReason(this.cancellationReason);
|
||||||
|
this.builder.setDescription(this.builder.eventType.description);
|
||||||
|
this.builder.setNotes(this.existingBooking.description);
|
||||||
this.builder.buildRescheduleLink(this.existingBooking.uid);
|
this.builder.buildRescheduleLink(this.existingBooking.uid);
|
||||||
} else {
|
} else {
|
||||||
throw new Error("buildForRescheduleEmail.missing.params.required");
|
throw new Error("buildForRescheduleEmail.missing.params.required");
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ ${organizer + attendees}
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getAdditionalNotes = (calEvent: CalendarEvent) => {
|
export const getAdditionalNotes = (calEvent: CalendarEvent) => {
|
||||||
|
if (!calEvent.additionalNotes) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return `
|
return `
|
||||||
${calEvent.organizer.language.translate("additional_notes")}:
|
${calEvent.organizer.language.translate("additional_notes")}:
|
||||||
${calEvent.additionalNotes}
|
${calEvent.additionalNotes}
|
||||||
@@ -53,6 +56,9 @@ ${calEvent.additionalNotes}
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getDescription = (calEvent: CalendarEvent) => {
|
export const getDescription = (calEvent: CalendarEvent) => {
|
||||||
|
if (!calEvent.description) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return `\n${calEvent.attendees[0].language.translate("description")}
|
return `\n${calEvent.attendees[0].language.translate("description")}
|
||||||
${calEvent.description}
|
${calEvent.description}
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in new issue
Block a user