Fix request reschedule organiser email (#3227)

* Fix request reschedule organizer email

* Updated book a new time link and removed manage or cancel action on user owner email request reschedule

* Fix let with const for a variable and change env var to a constant from lib

Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
alannnc 2022-07-07 16:25:05 -06:00 committed by GitHub
parent 2c30976e99
commit 6b0ac96b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 9 deletions

View File

@ -173,10 +173,10 @@ const handler = async (
director.setBuilder(builder);
director.setExistingBooking(bookingToReschedule);
director.setCancellationReason(cancellationReason);
if (!!event) {
await director.buildWithoutEventTypeForRescheduleEmail();
} else {
if (event) {
await director.buildForRescheduleEmail();
} else {
await director.buildWithoutEventTypeForRescheduleEmail();
}
// Handling calendar and videos cancellation

View File

@ -92,7 +92,7 @@
"meeting_password": "Meeting Password",
"meeting_url": "Meeting URL",
"meeting_request_rejected": "Your meeting request has been rejected",
"rescheduled_event_type_subject": "Rescheduled: {{eventType}} with {{name}} at {{date}}",
"rescheduled_event_type_subject": "Request for reschedule sent: {{eventType}} with {{name}} at {{date}}",
"requested_to_reschedule_subject_attendee": "Action Required Reschedule: Please book a new time for {{eventType}} with {{name}}",
"rejected_event_type_with_organizer": "Rejected: {{eventType}} with {{organizer}} on {{date}}",
"hi": "Hi",

View File

@ -1,8 +1,9 @@
import { Prisma, Booking } from "@prisma/client";
import dayjs from "@calcom/dayjs";
import short from "short-uuid";
import { v5 as uuidv5 } from "uuid";
import dayjs from "@calcom/dayjs";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { getTranslation } from "@calcom/lib/server/i18n";
import prisma from "@calcom/prisma";
import { CalendarEvent } from "@calcom/types/Calendar";
@ -70,7 +71,7 @@ export class CalendarEventBuilder implements ICalendarEventBuilder {
if (!this.eventType) {
throw new Error("exec BuildEventObjectFromInnerClass before calling this function");
}
let users = this.eventType.users;
const users = this.eventType.users;
/* If this event was pre-relationship migration */
if (!users.length && this.eventType.userId) {
@ -314,8 +315,7 @@ export class CalendarEventBuilder implements ICalendarEventBuilder {
const queryParams = new URLSearchParams();
queryParams.set("rescheduleUid", `${booking.uid}`);
slug = `${slug}?${queryParams.toString()}`;
const rescheduleLink = `${process.env.NEXT_PUBLIC_WEBAPP_URL}/${slug}`;
const rescheduleLink = `${WEBAPP_URL}/${slug}?${queryParams.toString()}`;
this.rescheduleLink = rescheduleLink;
} catch (error) {
if (error instanceof Error) {

View File

@ -16,6 +16,7 @@ export const OrganizerRequestRescheduledEmail = (
}
headerType="calendarCircle"
subject="rescheduled_event_type_subject"
callToAction={null}
{...props}
/>
);

View File

@ -1,6 +1,7 @@
import { createEvent, DateArray, Person } from "ics";
import dayjs from "@calcom/dayjs";
import { getRichDescription } from "@calcom/lib/CalEventParser";
import { CalendarEvent } from "@calcom/types/Calendar";
import { renderEmail } from "../";
@ -27,7 +28,7 @@ export default class OrganizerRequestRescheduledEmail extends OrganizerScheduled
name: this.calEvent.attendees[0].name,
date: this.getFormattedDate(),
})}`,
html: renderEmail("OrganizerScheduledEmail", {
html: renderEmail("OrganizerRequestRescheduledEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.organizer,
}),
@ -78,4 +79,15 @@ export default class OrganizerRequestRescheduledEmail extends OrganizerScheduled
}
return icsEvent.value;
}
// @OVERRIDE
protected getTextBody(title = "", subtitle = "", extraInfo = "", callToAction = ""): string {
return `
${this.t(title)}
${this.t(subtitle)}
${extraInfo}
${getRichDescription(this.calEvent)}
${callToAction}
`.trim();
}
}