cal/packages/emails/templates/organizer-request-email.ts
Joe Au-Yeung 8b07b839e9
Fix - add team members to emails (#7207)
* On booking add team members & translation

* Add team members to round robin create

* Only update calendars on reschedule if there is a calendar reference

* Send email on reschedules

* Send team email on cancelled event

* Add team members to calendar event description

* Clean up

* Convert other emails to organizer & teams

* Type check fixes

* More type fixes

* Change organizer scheduled input to an object

* early return updateCalendarEvent

* Introduce team member type

* Fix type errors

* Put team members before attendees

* Remove lodash cloneDeep

* Update packages/core/EventManager.ts

Co-authored-by: Omar López <zomars@me.com>

* Remove booking select object

* Revert "Remove booking select object"

This reverts commit 9f121ff4eb.

* Refactor email manager (#7270)

Co-authored-by: zomars <zomars@me.com>

* Type change

* Remove conditional check for updateAllCalendarEvents

---------

Co-authored-by: zomars <zomars@me.com>
2023-02-27 13:45:40 -07:00

34 lines
1.2 KiB
TypeScript

import { APP_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
export default class OrganizerRequestEmail extends OrganizerScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
subject: `${this.t("awaiting_approval")}: ${this.calEvent.title}`,
html: renderEmail("OrganizerRequestEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.organizer,
}),
text: this.getTextBody("event_awaiting_approval"),
};
}
protected getTextBody(title = "event_awaiting_approval"): string {
return super.getTextBody(
title,
`${this.calEvent.organizer.language.translate("someone_requested_an_event")}`,
"",
`${this.calEvent.organizer.language.translate("confirm_or_reject_request")}
${process.env.NEXT_PUBLIC_WEBAPP_URL} + ${
this.calEvent.recurringEvent?.count ? "/bookings/recurring" : "/bookings/upcoming"
}`
);
}
}