fix(api): return original email without OAuth suffix in bookings (#25593)
* fix(api): remove OAuth client ID suffix from email in booking API responses Fixes #25494 | Linear: CAL-6843 When managed users create or receive bookings, their emails were being returned with an internal OAuth client ID suffix (e.g., [email protected]). This suffix is used internally for user identification but should not be exposed in API responses. Changes: - Add cleanOAuthEmailSuffix() helper using CUID regex pattern - Clean email suffix in hosts[], attendees[], bookingFieldsResponses.email, bookingFieldsResponses.guests[], and reassignedTo.email - Pattern consistent with google-calendar.service.ts implementation Affected output methods: - getOutputBooking - getOutputRecurringBooking - getOutputSeatedBooking - getOutputRecurringSeatedBooking - getOutputReassignedBooking - getHost * refactor(api): preserve original email, add displayEmail field Per team discussion, keep original email unchanged to avoid breaking changes for platform customers. Add displayEmail field with CUID suffix removed for display purposes * feat(api): add displayEmail to booking output DTOs Add displayEmail property to BookingAttendee, BookingHost and ReassignedToDto for API documentation and type safety * test(api): add e2e tests for displayEmail fields in managed user bookings Add tests to verify that displayEmail fields correctly strip CUID suffix from OAuth managed user emails in booking API responses: - Test host displayEmail returns email without CUID suffix - Test attendee displayEmail returns email without CUID suffix - Test bookingFieldsResponses.displayEmail returns clean email - Test displayGuests array returns emails without CUID suffix * false positive breaking change * false positive breaking change * test(api): update existing e2e tests to expect displayEmail field * fix(api): add missing displayEmail to seated booking test assertions The seated booking tests were missing displayEmail in the attendee assertions for the second booking test and cancel-as-host test, causing CI test failures --------- Co-authored-by: cal.com <[email protected]> Co-authored-by: Morgan <[email protected]>
This commit is contained in:
14 files changed
+226
-5
No files matched your search
@@ -29,6 +29,11 @@ class BookingAttendee {
|
||||
@Expose()
|
||||
email!: string;
|
||||
|
||||
@ApiProperty({ type: String, example: "[email protected]", description: "Clean email for display purposes" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
displayEmail!: string;
|
||||
|
||||
@ApiProperty({ type: String, example: "America/New_York" })
|
||||
@IsTimeZone()
|
||||
@Expose()
|
||||
@@ -95,6 +100,11 @@ class BookingHost {
|
||||
@Expose()
|
||||
email!: string;
|
||||
|
||||
@ApiProperty({ type: String, example: "[email protected]", description: "Clean email for display purposes" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
displayEmail!: string;
|
||||
|
||||
@ApiProperty({ type: String, example: "jane100" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
@@ -395,6 +405,11 @@ class ReassignedToDto {
|
||||
@IsEmail()
|
||||
@Expose()
|
||||
email!: string;
|
||||
|
||||
@ApiProperty({ type: String, example: "[email protected]", description: "Clean email for display purposes" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
displayEmail!: string;
|
||||
}
|
||||
|
||||
export class ReassignBookingOutput_2024_08_13 {
|
||||
|
||||
Reference in new issue
Block a user