Skip to content

Comments

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

Merged
anikdhabal merged 6 commits intomainfrom
devin/fix-seated-reschedule-emails-1753984970
Aug 11, 2025
Merged

fix: ensure seated event reschedules send proper reschedule emails#22849
anikdhabal merged 6 commits intomainfrom
devin/fix-seated-reschedule-emails-1753984970

Conversation

@anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Jul 31, 2025

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 handleSeats and handleNewBooking where the main booking flow was overriding seated reschedule emails with scheduled 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>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

The 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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/fix-seated-reschedule-emails-1753984970

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

devin-ai-integration bot and others added 2 commits August 1, 2025 05:12
- 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>
@vercel
Copy link

vercel bot commented Aug 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Aug 11, 2025 11:47am
cal-eu ⬜️ Ignored (Inspect) Aug 11, 2025 11:47am

@anikdhabal anikdhabal marked this pull request as ready for review August 11, 2025 11:47
@anikdhabal anikdhabal requested a review from a team as a code owner August 11, 2025 11:47
@anikdhabal anikdhabal enabled auto-merge (squash) August 11, 2025 11:47
@graphite-app graphite-app bot requested a review from a team August 11, 2025 11:47
@dosubot dosubot bot added bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working labels Aug 11, 2025
@graphite-app
Copy link

graphite-app bot commented Aug 11, 2025

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/features/bookings/lib/handleNewBooking.ts (1)

1944-1957: Add a brief inline comment for future maintainers

The 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 noEmail need to suppress these emails too? If yes, guard this call (e.g., skip when noEmail === 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

📥 Commits

Reviewing files that changed from the base of the PR and between a90d765 and 426c425.

📒 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 use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.ts
  • packages/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.ts
  • packages/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 reschedules

This 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 exists

Awaiting sendRescheduledSeatEmailAndSMS here ensures the attendee/organizer receive the proper reschedule notification in this branch.

@github-actions
Copy link
Contributor

E2E results are ready!

@anikdhabal anikdhabal requested a review from volnei August 11, 2025 14:17
@anikdhabal anikdhabal merged commit 76b68be into main Aug 11, 2025
82 of 85 checks passed
@anikdhabal anikdhabal deleted the devin/fix-seated-reschedule-emails-1753984970 branch August 11, 2025 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working core area: core, team members only ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants