Skip to content

Conversation

@Parship12
Copy link

@Parship12 Parship12 commented Oct 25, 2025

What does this PR do?

  • Fixes Make it possible to edit a booking before confirming it #24599
  • Fixes CAL-6622
  • Enables editing bookings before confirmation and adds optional attendee pending email notifications to reduce emails.
  • The workflow will be like this:
    • Before changes (3 emails):

      • User books -> Pending email
      • Admin confirms -> confirmation email
      • Admin edits -> update email
    • After changes (2 emails):

      • User books -> Pending email
      • Admin edits -> No email sent
      • Admin confirms -> Confirmation email

Two new features:

  • Add guests to pending booking:

    • Create a pending booking
    • Add guests before confirmation:
      • Add a guest email
      • Expected: No email sent to new guest
    • Confirm Booking:
      • Click "Confirm"
      • Expected: Both original attendee and guest get confirmation emails
  • Test the New Toggle

    • Enable the Toggle:
      • Go to Event Types -> choose an event type -> Advanced tab
      • Scroll down to find "Disable pending booking emails for attendees"
      • Note: This toggle only appears when "Requires Confirmation" is enabled
    • Test with toggle ON:
      • Submit a new booking
      • Expected: No pending email sent to attendee
      • Confirm the booking
      • Expected: Only confirmation email sent
    • Test with toggle OFF:
      • Disable the toggle
      • Submit a new booking
      • Expected: Pending email sent to attendee

Please watch the below screen recordings for better understanding of the newly added features

Video Demo (if applicable):

  • Edit Bookings before confirmation:
Screen.Recording.2025-10-25.19273211.mp4
  • Optional Attendee pending emails:
Screen.Recording.2025-10-25.200338.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Summary by cubic

Enable editing of pending bookings before confirmation and add a setting to disable attendee pending emails, reducing unnecessary notifications. Addresses Linear CAL-6622 by making pending emails optional and shifting notifications to confirmation.

  • New Features

    • Edit pending bookings without sending emails (add guests, edit location).
    • Guests added to pending bookings get confirmation emails only after the booking is accepted.
    • Location change emails are sent only for accepted bookings.
    • New toggle: “Disable pending booking emails for attendees” in Event Type > Advanced (visible when “Requires Confirmation” is on).
  • Migration

    • Turn on “Requires Confirmation,” then enable “Disable pending booking emails for attendees.”
    • Toggle ON: no pending email; attendees receive only the confirmation email.
    • Toggle OFF: pending email is sent as usual.

@Parship12 Parship12 requested a review from a team as a code owner October 25, 2025 16:01
@vercel
Copy link

vercel bot commented Oct 25, 2025

@Parship12 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Oct 25, 2025
@github-actions github-actions bot added Low priority Created by Linear-GitHub Sync ✨ feature New feature or request labels Oct 25, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 8 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/emails/email-manager.ts">

<violation number="1" location="packages/emails/email-manager.ts:444">
Adding this early return also skips the attendee SMS, so the new &quot;Disable pending booking emails&quot; toggle stops all pending notifications, not just the email. Please gate only the email send while keeping the SMS dispatch intact.</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

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

eventTypeMetadata?: EventTypeMetadata
) => {
if (eventTypeDisableAttendeeEmail(eventTypeMetadata)) return;
if (eventTypeMetadata?.disableStandardEmails?.request?.attendee) return;
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this early return also skips the attendee SMS, so the new "Disable pending booking emails" toggle stops all pending notifications, not just the email. Please gate only the email send while keeping the SMS dispatch intact.

Prompt for AI agents
Address the following comment on packages/emails/email-manager.ts at line 444:

<comment>Adding this early return also skips the attendee SMS, so the new &quot;Disable pending booking emails&quot; toggle stops all pending notifications, not just the email. Please gate only the email send while keeping the SMS dispatch intact.</comment>

<file context>
@@ -441,6 +441,7 @@ const _sendAttendeeRequestEmailAndSMS = async (
   eventTypeMetadata?: EventTypeMetadata
 ) =&gt; {
   if (eventTypeDisableAttendeeEmail(eventTypeMetadata)) return;
+  if (eventTypeMetadata?.disableStandardEmails?.request?.attendee) return;
 
   const calendarEvent = formatCalEvent(calEvent);
</file context>

✅ Addressed in 51cf524

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cubic-dev-ai How it will effect the SMS dispatch? Can you please describe the issue properly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Parship12 Of course. The early return statement you've added causes the _sendAttendeeRequestEmailAndSMS function to exit before the SMS sending logic is executed.

I suggested a change because the new toggle is specifically for disabling emails, but your implementation also disables SMS notifications for pending bookings.

Here's the relevant part of the function:

// packages/emails/email-manager.ts:446
const _sendAttendeeRequestEmailAndSMS = async (
  // ...
) => {
  if (eventTypeDisableAttendeeEmail(eventTypeMetadata)) return;
  // Your new line causes the function to exit here
  if (eventTypeMetadata?.disableStandardEmails?.request?.attendee) return;

  const calendarEvent = formatCalEvent(calEvent);
  // This sends the email
  await sendEmail(() => new AttendeeRequestEmail(calendarEvent, attendee));
  
  // This SMS logic is never reached if the new toggle is on
  const eventRequestSms = new EventRequestSMS(calendarEvent);
  await eventRequestSms.sendSMSToAttendee(attendee);
};

To fix this, you can wrap just the email-sending line with the conditional check, ensuring the SMS is always sent:

const _sendAttendeeRequestEmailAndSMS = async (
  calEvent: CalendarEvent,
  attendee: Person,
  eventTypeMetadata?: EventTypeMetadata
) => {
  if (eventTypeDisableAttendeeEmail(eventTypeMetadata)) return;

  const calendarEvent = formatCalEvent(calEvent);
  if (!eventTypeMetadata?.disableStandardEmails?.request?.attendee) {
    await sendEmail(() => new AttendeeRequestEmail(calendarEvent, attendee));
  }
  
  const eventRequestSms = new EventRequestSMS(calendarEvent);
  await eventRequestSms.sendSMSToAttendee(attendee);
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Parship12 nice, making it draft until you address this

@dhairyashiil dhairyashiil marked this pull request as draft October 25, 2025 22:35
@Parship12 Parship12 marked this pull request as ready for review October 26, 2025 03:38
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 8 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Created by Linear-GitHub Sync ✨ feature New feature or request Low priority Created by Linear-GitHub Sync size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it possible to edit a booking before confirming it

2 participants