fix: ensure seated event reschedules send proper reschedule emails (#22849)

* fix: ensure seated event reschedules send proper reschedule emails

- Fix attendee reschedule bypass when no existing booking at new time slot
- Remove restrictive isConfirmedByDefault conditions from owner reschedule functions
- Add seatedRescheduleEmailSent flag to coordinate email sending between handleSeats and handleNewBooking
- Prevent main flow from overriding seated reschedule emails with scheduled emails

Fixes issue where both organizer and attendee receive schedule emails instead of reschedule emails during seated event reschedules.

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>

* refine: only apply seatedRescheduleEmailSent check for seated bookings

- Add eventType.seatsPerTimeSlot condition to ensure flag only affects seated events
- Prevents interference with regular booking email flow

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>

* fix: replace unreliable flag mechanism with direct seated reschedule detection

- Remove seatedRescheduleEmailSent flag from HandleSeatsResultBooking type
- Remove flag assignments from seated reschedule functions
- Use direct detection (eventType.seatsPerTimeSlot && rescheduleUid) in handleNewBooking
- Maintain email sending fixes for attendee reschedules and owner reschedule conditions
- Resolve TypeScript type mismatch issues with type-safe approach

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>

* Update attendeeRescheduleSeatedBooking.ts

* revert

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Anik Dhabal Babu
2025-08-11 12:43:56 -03:00
committed by GitHub
co-authored by anik@cal.com Devin AI
parent c20e723e34
commit 76b68bebd7
2 changed files with 3 additions and 1 deletions
@@ -1990,7 +1990,7 @@ async function handler(
})
);
if (!isDryRun) {
if (!isDryRun && !(eventType.seatsPerTimeSlot && rescheduleUid)) {
await sendScheduledEmailsAndSMS(
{
...evt,
@@ -51,6 +51,8 @@ const attendeeRescheduleSeatedBooking = async (
// We don't want to trigger rescheduling logic of the original booking
originalRescheduledBooking = null;
await sendRescheduledSeatEmailAndSMS(evt, seatAttendee as Person, eventType.metadata);
return null;
}