fix: respect disableStandardEmails setting for cancellation emails#26681
fix: respect disableStandardEmails setting for cancellation emails#26681AyushMhaisane wants to merge 2 commits intocalcom:mainfrom
Conversation
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/features/bookings/lib/handleCancelBooking.ts">
<violation number="1" location="packages/features/bookings/lib/handleCancelBooking.ts:693">
P1: The `disableStandardEmails` check is incorrect. This field is an object with nested `all` and `confirmation` properties (each with `host` and `attendee` booleans), not a simple boolean. Checking `!disableStandardEmails` will only be true when the object is undefined, not when the user has enabled the setting. Consider checking `disableStandardEmails?.all?.host` and `disableStandardEmails?.all?.attendee` separately for host and attendee cancellation emails.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| const eventTypeMetadata = bookingToDelete?.eventType?.metadata as EventTypeMetadata; | ||
| const disableStandardEmails = eventTypeMetadata?.disableStandardEmails; | ||
|
|
||
| if (!disableStandardEmails) { |
There was a problem hiding this comment.
P1: The disableStandardEmails check is incorrect. This field is an object with nested all and confirmation properties (each with host and attendee booleans), not a simple boolean. Checking !disableStandardEmails will only be true when the object is undefined, not when the user has enabled the setting. Consider checking disableStandardEmails?.all?.host and disableStandardEmails?.all?.attendee separately for host and attendee cancellation emails.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/features/bookings/lib/handleCancelBooking.ts, line 693:
<comment>The `disableStandardEmails` check is incorrect. This field is an object with nested `all` and `confirmation` properties (each with `host` and `attendee` booleans), not a simple boolean. Checking `!disableStandardEmails` will only be true when the object is undefined, not when the user has enabled the setting. Consider checking `disableStandardEmails?.all?.host` and `disableStandardEmails?.all?.attendee` separately for host and attendee cancellation emails.</comment>
<file context>
@@ -687,13 +687,19 @@ async function handler(input: CancelBookingInput) {
+ const eventTypeMetadata = bookingToDelete?.eventType?.metadata as EventTypeMetadata;
+ const disableStandardEmails = eventTypeMetadata?.disableStandardEmails;
+
+ if (!disableStandardEmails) {
+ // TODO: if emails fail try to requeue them
+ if (!platformClientId || (platformClientId && arePlatformEmailsEnabled)) {
</file context>
✅ Addressed in 864f372
|
Thanks for your work. Check this:- #26417 (comment) |
Fixes #26417
Description
Currently, the
BookingCancelledEmailis sent even when the "Disable default emails" setting is enabled in the Event Type.This PR adds a check for
eventType.metadata.disableStandardEmailsinhandleCancelBooking.ts. If this setting is true, the default cancellation email will be skipped.Type of change
How should this be tested?