fix: api v2 - platform users can disable emails and display their links (#14604)

* fix: disable emails with oauthCLient settings and hide empty links

* fixup! fix: disable emails with oauthCLient settings and hide empty links

* feat: enable to display booking success page link in emails

* fixup! feat: enable to display booking success page link in emails

* fixup! Merge branch 'fix-no-email-booking-hide-empty-links' of github.com:calcom/cal.com into fix-no-email-booking-hide-empty-links

* fixup! fixup! Merge branch 'fix-no-email-booking-hide-empty-links' of github.com:calcom/cal.com into fix-no-email-booking-hide-empty-links

* fixup! Merge branch 'main' into fix-no-email-booking-hide-empty-links

* fixup! Merge branch 'main' into fix-no-email-booking-hide-empty-links

* fixup! Merge branch 'fix-no-email-booking-hide-empty-links' of github.com:calcom/cal.com into fix-no-email-booking-hide-empty-links

---------

Co-authored-by: Lauris Skraucis <[email protected]>
This commit is contained in:
MorganandLauris Skraucis authored and GitHub committed 2024-04-18 12:43:17 +00:00
1 parent 8b2e46a6fa
commit 480977c2b5
4 files changed
+84 -31

No files matched your search

@@ -129,6 +129,7 @@ export type CustomRequest = NextApiRequest & {
platformRescheduleUrl?: string;
platformCancelUrl?: string;
platformBookingUrl?: string;
arePlatformEmailsEnabled?: boolean;
};
async function handler(req: CustomRequest) {
@@ -142,6 +143,7 @@ async function handler(req: CustomRequest) {
platformCancelUrl,
platformClientId,
platformRescheduleUrl,
arePlatformEmailsEnabled,
} = req;
if (!bookingToDelete || !bookingToDelete.user) {
@@ -559,7 +561,8 @@ async function handler(req: CustomRequest) {
}
// TODO: if emails fail try to requeue them
await sendCancelledEmails(evt, { eventName: bookingToDelete?.eventType?.eventName });
if (!platformClientId || (platformClientId && arePlatformEmailsEnabled))
await sendCancelledEmails(evt, { eventName: bookingToDelete?.eventType?.eventName });
} catch (error) {
console.error("Error deleting event", error);
}