Skip to content

Add guest management functionality to existing bookings - #3

Open
ShashankFC wants to merge 1 commit into
guest-management-basefrom
guest-management-enhanced
Open

Add guest management functionality to existing bookings#3
ShashankFC wants to merge 1 commit into
guest-management-basefrom
guest-management-enhanced

Conversation

@ShashankFC

@ShashankFC ShashankFC commented Feb 4, 2026

Copy link
Copy Markdown

Test 10nn

Summary by CodeRabbit

Release Notes

  • New Features
    • Added ability to add multiple guests to existing bookings via a dedicated dialog interface
    • Email validation ensures all guest emails are unique and valid
    • Automated email notifications sent to organizer and attendees when new guests are added
    • Calendar events automatically updated to reflect newly added attendees

✏️ Tip: You can customize this high-level summary in your review settings.

nn---n*Replicated from [ai-code-review-evaluation/cal.com-coderabbit#10](https://github.com/ai-code-review-evaluation/cal.com-coderabbit/pull/10)*

EntelligenceAI PR Summary

This PR adds functionality to add guests to existing bookings with full email notification support and calendar synchronization.

  • New AddGuestsDialog component in web app with email validation and tRPC integration
  • Backend tRPC mutation handler with authorization (team admin/owner, organizer, or attendee), guest validation against existing attendees and blacklist
  • Email notification system sending differentiated emails to organizers, team members, new guests (scheduled email), and existing attendees (add guests notification)
  • New email templates (AttendeeAddGuestsEmail, OrganizerAddGuestsEmail) with ICS calendar attachments
  • Reusable MultiEmail form component with lazy loading for dynamic email input management
  • Internationalization strings for notifications, errors, and UI labels
  • Calendar provider synchronization via EventManager
  • Support for recurring events, video calls, and seat-based bookings

* feat: ability to add guests via app.cal.com/bookings

* fix: some update

* fix: minor issue

* fix: final update

* update

* update

* add requested changes

* fix type error

* small update

* final update

* fix type error

* fix location

* update calender event

---------

Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>

@entelligence-ai-pr-reviews entelligence-ai-pr-reviews Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Walkthrough

This PR implements a comprehensive feature for adding guests to existing bookings. The implementation includes a new UI dialog component with email validation, backend tRPC mutation handler with authorization checks, and email notification system. The feature allows authorized users (organizers, team admins, or attendees) to add multiple guests via email to calendar events. New guests receive scheduled event emails while existing attendees are notified of the additions. The system validates email uniqueness, updates calendar providers, and maintains booking integrity across recurring events and various booking configurations. A reusable MultiEmail form component is introduced to support the multi-email input functionality.

Changes

File(s) Summary
apps/web/components/booking/BookingListItem.tsx Added 'Add Guests' menu item with user-plus icon in booking actions dropdown, integrated AddGuestsDialog component with state management for dialog visibility.
apps/web/components/dialog/AddGuestsDialog.tsx Introduced new modal dialog component for adding guests with Zod email validation, tRPC mutation integration, loading states, toast notifications, and automatic cache invalidation.
apps/web/public/static/locales/en/common.json Added i18n strings for guest addition feature including notification messages, email subject templates, error messages, and UI labels.
packages/emails/email-manager.ts Added sendAddGuestsEmails function to send differentiated notifications to organizers, team members, newly added guests, and existing attendees.
packages/emails/src/templates/AttendeeAddGuestsEmail.tsx
packages/emails/src/templates/OrganizerAddGuestsEmail.tsx
Introduced specialized email template components wrapping existing scheduled email templates with customized props for add-guests notifications.
packages/emails/templates/attendee-add-guests-email.ts
packages/emails/templates/organizer-add-guests-email.ts
Implemented email template classes extending scheduled email classes to generate ICS calendar attachments and localized notifications for guest additions.
packages/emails/src/templates/index.ts Exported new OrganizerAddGuestsEmail and AttendeeAddGuestsEmail templates to public API.
packages/trpc/server/routers/viewer/bookings/_router.tsx Added addGuests mutation endpoint with lazy-loaded handler and input schema validation.
packages/trpc/server/routers/viewer/bookings/addGuests.handler.ts Implemented tRPC handler with authorization checks, guest validation, database updates, calendar synchronization, and email notifications.
packages/trpc/server/routers/viewer/bookings/addGuests.schema.ts Defined Zod schema for validating booking ID and guest email array inputs.
packages/ui/form/MultiEmail.tsx Created dynamic multi-email input component with add/remove functionality, validation, and dark mode support.
packages/ui/form/MultiEmailLazy.tsx Introduced lazy-loading wrapper for MultiEmail component using Next.js dynamic imports to optimize bundle size.
packages/ui/index.tsx Exported MultiEmail component from UI package's main entry point.

Sequence Diagram

This diagram shows the interactions between components:

sequenceDiagram
    actor User
    participant BookingDetails
    participant MenuSystem
    participant AddGuestsDialog
    participant State

    User->>BookingDetails: Views booking details page
    BookingDetails->>State: Initialize isOpenAddGuestsDialog = false
    BookingDetails->>MenuSystem: Render menu with "additional_guests" option
    
    User->>MenuSystem: Clicks "additional_guests" menu item
    MenuSystem->>BookingDetails: onClick handler triggered
    BookingDetails->>State: setIsOpenAddGuestsDialog(true)
    State-->>BookingDetails: State updated
    
    BookingDetails->>AddGuestsDialog: Render with props<br/>(isOpenDialog, bookingId)
    AddGuestsDialog->>User: Display dialog
    
    alt User adds guests
        User->>AddGuestsDialog: Submits guest information
        Note over AddGuestsDialog: Guest addition logic<br/>(implementation in dialog)
        AddGuestsDialog->>BookingDetails: Close dialog request
    else User cancels
        User->>AddGuestsDialog: Clicks cancel/close
        AddGuestsDialog->>BookingDetails: Close dialog request
    end
    
    BookingDetails->>State: setIsOpenAddGuestsDialog(false)
    State-->>BookingDetails: State updated
    AddGuestsDialog->>User: Dialog closes
Loading

🔗 Cross-Repository Impact Analysis

Enable automatic detection of breaking changes across your dependent repositories. → Set up now

Learn more about Cross-Repository Analysis

What It Does

  • Automatically identifies repositories that depend on this code
  • Analyzes potential breaking changes across your entire codebase
  • Provides risk assessment before merging to prevent cross-repo issues

How to Enable

  1. Visit Settings → Code Management
  2. Configure repository dependencies
  3. Future PRs will automatically include cross-repo impact analysis!

Benefits

  • 🛡️ Prevent breaking changes across repositories
  • 🔍 Catch integration issues before they reach production
  • 📊 Better visibility into your multi-repo architecture

▶️AI Code Reviews for VS Code, Cursor, Windsurf
Install the extension

Note for Windsurf Please change the default marketplace provider to the following in the windsurf settings:

Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery

Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items

Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts below

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @entelligenceai + *your message*
Example: @entelligenceai Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @entelligenceai + *feedback*
Example: @entelligenceai Do not comment on `save_auth` function !

Also you can trigger various commands with the bot by doing
@entelligenceai command

The current supported commands are

  1. config - shows the current config
  2. retrigger_review - retriggers the review

More commands to be added soon.


emailsToSend.push(
...calendarEvent.attendees.map((attendee) => {
if (newGuests.includes(attendee.email)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Correctness: In sendAddGuestsEmails, both AttendeeScheduledEmail and AttendeeAddGuestsEmail are passed the calendarEvent object without respecting the hideCalendarNotes flag. This leaks private notes to attendees. Mirror the sanitization used in sendScheduledEmails: pass { ...calendarEvent, ...(calendarEvent.hideCalendarNotes && { additionalNotes: undefined }) } to these constructors.

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

In `packages/emails/email-manager.ts` around line 541, update the new-guest branch in `sendAddGuestsEmails` so `AttendeeScheduledEmail` receives a sanitized event object that removes `additionalNotes` when `hideCalendarNotes` is true (same behavior as `sendScheduledEmails`). Apply the provided diff and keep formatting consistent.

Comment on lines +45 to +47

const isTeamAdminOrOwner =
(await isTeamAdmin(user.id, booking.eventType?.teamId ?? 0)) &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Correctness: The isTeamAdminOrOwner check (lines 48-50) uses &&, which requires a user to be both an admin and an owner. This will incorrectly block team admins who are not owners. Change && to ||.

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

In `packages/trpc/server/routers/viewer/bookings/addGuests.handler.ts` around lines 45-47, change the admin/owner permission check to use logical OR instead of AND so either role grants access. Apply the provided diff exactly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants