fix: ensure seated event reschedules send proper reschedule emails#22849
fix: ensure seated event reschedules send proper reschedule emails#22849anikdhabal merged 6 commits intomainfrom
Conversation
- 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>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
WalkthroughThe changes refine notification behavior around rescheduling for seated, time-slot-based events. In handleNewBooking.ts, scheduled emails/SMS are now sent only when not a dry run and not a reschedule for seats-per-time-slot event types. In attendeeRescheduleSeatedBooking.ts, when no new time slot booking is created during a reschedule, the system now awaits sending rescheduled seat email/SMS to the attendee before returning. No exported/public signatures were modified. Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
- 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>
…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>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (08/11/25)1 reviewer was added to this PR based on Keith Williams's automation. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/features/bookings/lib/handleNewBooking.ts (1)
1944-1957: Add a brief inline comment for future maintainersThe condition is subtle. A quick comment will prevent regressions.
- if (!isDryRun && !(eventType.seatsPerTimeSlot && rescheduleUid)) { + // For seated reschedules, handleSeats reschedule flow sends the reschedule emails/SMS. + // Suppress "scheduled" emails here to avoid overriding those reschedule notifications. + if (!isDryRun && !(eventType.seatsPerTimeSlot && rescheduleUid)) {Also consider adding unit tests that assert:
- Seated + reschedule: scheduled emails are not sent; rescheduled seat emails are sent instead.
- Non-seated + new booking: scheduled emails are sent as before.
packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.ts (1)
54-55: Verify platform “noEmail” semantics and iCalUID for ICS consistency
- Does platform-triggered booking with
noEmailneed to suppress these emails too? If yes, guard this call (e.g., skip whennoEmail === true). The existing function honors metadata-based disables, but not platform-level “noEmail”.- For ICS consistency: in the other branch you set the iCalUID to the new booking’s iCalUID before sending. Here (no newTimeSlotBooking), consider sending with the seat-level iCalUID you later compute for the new booking to avoid mismatched UIDs in attendee calendars.
Happy to draft a minimal patch once you confirm desired behavior for platform “noEmail” and iCalUID usage.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/features/bookings/lib/handleNewBooking.ts(1 hunks)packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts
📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
**/*.ts: For Prisma queries, only select data you need; never useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.tspackages/features/bookings/lib/handleNewBooking.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()in hot paths like loops
Files:
packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.tspackages/features/bookings/lib/handleNewBooking.ts
🧬 Code Graph Analysis (1)
packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.ts (2)
packages/emails/email-manager.ts (1)
sendRescheduledSeatEmailAndSMS(304-323)packages/types/Calendar.d.ts (1)
Person(33-45)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Detect changes
🔇 Additional comments (2)
packages/features/bookings/lib/handleNewBooking.ts (1)
1944-1957: Correct guard to prevent “scheduled” emails on seated reschedulesThis aligns with the PR goal: it avoids overriding reschedule emails with scheduled ones when rescheduling a seats-per-time-slot event.
packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.ts (1)
54-55: Good: Explicitly send rescheduled seat comms when no new time-slot booking existsAwaiting
sendRescheduledSeatEmailAndSMShere ensures the attendee/organizer receive the proper reschedule notification in this branch.
E2E results are ready! |
Fix seated event reschedule email issues
Summary
Fixes a critical issue where both organizer and attendee were receiving "schedule emails" instead of "reschedule emails" when rescheduling seated events. The root cause was a coordination problem between
handleSeatsandhandleNewBookingwhere the main booking flow was overriding seated reschedule emails with scheduled emails.