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

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)*

* 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>
@ShashankFC ShashankFC requested a review from Copilot January 30, 2026 10:18

Copilot AI 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.

Pull request overview

This PR adds functionality to allow users to add additional guests to existing bookings. The feature includes a new dialog interface for email input with validation, backend support for updating bookings and calendar events, and automated email notifications.

Changes:

  • Added a new MultiEmail UI component for managing multiple email inputs with validation
  • Implemented a tRPC endpoint addGuests that validates permissions, filters duplicate/blacklisted emails, updates the database, and syncs with calendar providers
  • Created email templates for notifying organizers and attendees about newly added guests

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/ui/index.tsx Exports the new MultiEmail component
packages/ui/form/MultiEmailLazy.tsx Lazy-loaded wrapper for the MultiEmail component
packages/ui/form/MultiEmail.tsx UI component for adding/removing multiple email addresses
packages/trpc/server/routers/viewer/bookings/addGuests.schema.ts Zod schema for validating addGuests input
packages/trpc/server/routers/viewer/bookings/addGuests.handler.ts Backend handler for adding guests to bookings
packages/trpc/server/routers/viewer/bookings/_router.tsx Registers the addGuests tRPC endpoint
packages/emails/templates/organizer-add-guests-email.ts Email template for notifying organizers
packages/emails/templates/attendee-add-guests-email.ts Email template for notifying attendees
packages/emails/src/templates/index.ts Exports new email template components
packages/emails/src/templates/OrganizerAddGuestsEmail.tsx React component for organizer email
packages/emails/src/templates/AttendeeAddGuestsEmail.tsx React component for attendee email
packages/emails/email-manager.ts Implements sendAddGuestsEmails function to dispatch emails
apps/web/public/static/locales/en/common.json Adds localization strings for the new feature
apps/web/components/dialog/AddGuestsDialog.tsx Dialog component for adding guests
apps/web/components/booking/BookingListItem.tsx Integrates AddGuestsDialog into the booking list UI
Comments suppressed due to low confidence (1)

packages/emails/email-manager.ts:1

  • The BLACKLISTED_GUEST_EMAILS environment variable is used but not documented. Add a comment explaining its purpose and expected format (comma-separated email list).
// eslint-disable-next-line no-restricted-imports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (!booking) throw new TRPCError({ code: "NOT_FOUND", message: "booking_not_found" });

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

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

The condition uses AND (&&) instead of OR (||), requiring the user to be both a team admin AND owner. This will always be false since a user cannot simultaneously satisfy both conditions. Change to || to allow either role.

Suggested change
(await isTeamAdmin(user.id, booking.eventType?.teamId ?? 0)) &&
(await isTeamAdmin(user.id, booking.eventType?.teamId ?? 0)) ||

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +75
<></>
)}

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

Replace empty fragment <></> with null for better readability and convention when rendering nothing.

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +29
const ZAddGuestsInputSchema = z.array(z.string().email()).refine((emails) => {
const uniqueEmails = new Set(emails);
return uniqueEmails.size === emails.length;
});

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

The uniqueness validation is duplicated between the client (AddGuestsDialog) and server (addGuests.handler.ts). Consider moving this schema to a shared location or relying solely on server-side validation.

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +78
const uniqueGuests = guests.filter(
(guest) =>
!booking.attendees.some((attendee) => guest === attendee.email) &&
!blacklistedGuestEmails.includes(guest)
);

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

Consider using guest.toLowerCase() when comparing against attendee emails and blacklisted emails to ensure case-insensitive matching, since email addresses are case-insensitive.

Copilot uses AI. Check for mistakes.
try {
await sendAddGuestsEmails(evt, guests);
} catch (err) {
console.log("Error sending AddGuestsEmails");

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

The error message doesn't include the actual error details. Change to console.error('Error sending AddGuestsEmails', err) to include the error object for debugging.

Suggested change
console.log("Error sending AddGuestsEmails");
console.error("Error sending AddGuestsEmails", err);

Copilot uses AI. Check for mistakes.
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.

3 participants