Hide other attendees on event types with seats#4766
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| name: bookingForm.getValues("name"), | ||
| email: bookingForm.getValues("email"), |
There was a problem hiding this comment.
Future proofing if someone wants payments for event types with seats
| name: bookingForm.getValues("name"), | ||
| email: bookingForm.getValues("email"), |
There was a problem hiding this comment.
For seats we want to pass the current attendee to the success page
| <Icon.FiUser | ||
| className={`mr-[10px] ml-[2px] mt-[2px] inline-block h-4 w-4 ${ | ||
| booking && booking.attendees.length / eventType.seatsPerTimeSlot >= 0.5 | ||
| ? "text-rose-600" | ||
| : booking && booking.attendees.length / eventType.seatsPerTimeSlot >= 0.33 | ||
| ? "text-yellow-500" | ||
| : "text-bookinghighlight" | ||
| }`} | ||
| /> |
There was a problem hiding this comment.
Change the seats color along with the number of seats left
| const { | ||
| location: _location, | ||
| name, | ||
| email, |
There was a problem hiding this comment.
The change is that we are reading the email that is in the URL params
| ? bookingInfo?.attendees | ||
| .filter((attendee) => attendee.email === email) | ||
| .map((attendee) => ( | ||
| <div key={attendee.name} className="mb-3"> | ||
| <p>{attendee.name}</p> | ||
| <p className="text-bookinglight">{attendee.email}</p> | ||
| </div> | ||
| )) |
There was a problem hiding this comment.
Since emails are unique across attendees, we can filter to display just the current attendee if seatsHideAttendees is true
| reminders: { | ||
| useDefault: true, | ||
| }, | ||
| guestsCanSeeOtherGuests: !calEventRaw.seatsHideAttendees, |
There was a problem hiding this comment.
Google Cal is the only calendar service we integrate right now that can natively hide the guest list
| new Promise((resolve, reject) => { | ||
| try { | ||
| const scheduledEmail = new AttendeeScheduledEmail(calEvent, invitee); | ||
| const scheduledEmail = new AttendeeScheduledEmail(calEvent, invitee, hideAttendees); |
There was a problem hiding this comment.
Only pass hideAttendees to the email being sent out to the attendee
| if (this.hideAttendees) { | ||
| this.calEvent.attendees = [ | ||
| { | ||
| ...this.attendee, | ||
| }, | ||
| ]; | ||
| } |
There was a problem hiding this comment.
Only pass the current attendee as the event attendee
| id?: number; | ||
| bookingId?: number; | ||
| locale?: string; |
There was a problem hiding this comment.
Current attendees have these fields
| ...calEventRaw.attendees.map(({ id, ...rest }) => ({ | ||
| rest, | ||
| responseStatus: "accepted", |
There was a problem hiding this comment.
We don't need id here and not all attendees will have an id if they are new to the event
There was a problem hiding this comment.
Let's add a eslint-ignore comment then
| ...event.attendees.map(({ id, ...rest }) => ({ | ||
| rest, | ||
| responseStatus: "accepted", | ||
| })), |
There was a problem hiding this comment.
We don't need id here and not all attendees will have an id if they are new to the event
| @@ -1,4 +1,5 @@ | |||
| import CloseCom from "@calcom/lib/CloseCom"; | |||
| import type { CloseComAttendees, CloseComCalendarEvent } from "@calcom/lib/CloseCom"; | |||
There was a problem hiding this comment.
@leog heads up, not sure why these tests were failing but I had to create Close.com specific types
| export type CloseComAttendees = { | ||
| attendees: { email: string; id: string; timeZone?: string }[]; | ||
| }; | ||
|
|
||
| export type CloseComCalendarEvent = { | ||
| attendees?: CloseComAttendees["attendees"]; | ||
| startTime: string; | ||
| additionalNotes?: string; | ||
| }; | ||
|
|
| const event = { | ||
| attendees, | ||
| } as CalendarEvent; | ||
| } as { attendees: { email: string; name: string | null; id: string }[] }; |
There was a problem hiding this comment.
Simplify this type to pass test
| startTime: now.toISOString(), | ||
| additionalNotes: "Some comment!", | ||
| } as CalendarEvent; | ||
| } as any; |
There was a problem hiding this comment.
Even though this is similar to line 171 it was still failing. Passes when cast as any type. This variable is declared anyways and does not rely on any external calls
* Add seatsHideAttendees to schema * Add migration * Add frontend option to hide attendees * Pass hide attendees to email * Hide attendee names on success email * Add types for existing attendees * Hide other attendees if hidden * Pass seatsHideAttendees to Google Cal * Add translation * Reduce redundancy * Fix type error * Change toggle to show attendee information * Minor text change * Fix type errors * Update snapshots * Merge branch 'main' into seats-hide-attendees * Add back email * Add close.com specific types * Add eslint ignore comments * Merge branch 'seats-hide-attendees' of https://github.com/calcom/cal.com into seats-hide-attendees * Simplify tests Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>
* Add seatsHideAttendees to schema * Add migration * Add frontend option to hide attendees * Pass hide attendees to email * Hide attendee names on success email * Add types for existing attendees * Hide other attendees if hidden * Pass seatsHideAttendees to Google Cal * Add translation * Reduce redundancy * Fix type error * Change toggle to show attendee information * Minor text change * Fix type errors * Update snapshots * Merge branch 'main' into seats-hide-attendees * Add back email * Add close.com specific types * Add eslint ignore comments * Merge branch 'seats-hide-attendees' of https://github.com/calcom/cal.com into seats-hide-attendees * Simplify tests Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>
What does this PR do?
This PR allows hiding attendee information from other attendees on event types with seats. The .ics file that is generated for attendees will also not contain other attendee information as well.
Fixes # (issue)
Environment: Staging(main branch) / Production
Type of change
How should this be tested?
Checklist