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., bob+cuid123@example.com). 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 <morgan@cal.com> Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
This commit is contained in:
co-authored by
cal.com
Morgan
parent
3e7e376100
commit
0994050b0f
@@ -31712,6 +31712,11 @@
|
||||
"type": "string",
|
||||
"example": "jane100@example.com"
|
||||
},
|
||||
"displayEmail": {
|
||||
"type": "string",
|
||||
"example": "jane100@example.com",
|
||||
"description": "Clean email for display purposes"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"example": "jane100"
|
||||
@@ -31721,10 +31726,11 @@
|
||||
"example": "America/Los_Angeles"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"displayEmail",
|
||||
"username",
|
||||
"timeZone"
|
||||
]
|
||||
@@ -31757,6 +31763,11 @@
|
||||
"type": "string",
|
||||
"example": "john@example.com"
|
||||
},
|
||||
"displayEmail": {
|
||||
"type": "string",
|
||||
"example": "john@example.com",
|
||||
"description": "Clean email for display purposes"
|
||||
},
|
||||
"timeZone": {
|
||||
"type": "string",
|
||||
"example": "America/New_York"
|
||||
@@ -31819,9 +31830,10 @@
|
||||
"example": "+1234567890"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"required": [
|
||||
"name",
|
||||
"email",
|
||||
"displayEmail",
|
||||
"timeZone",
|
||||
"absent"
|
||||
]
|
||||
@@ -32168,6 +32180,11 @@
|
||||
"type": "string",
|
||||
"example": "john@example.com"
|
||||
},
|
||||
"displayEmail": {
|
||||
"type": "string",
|
||||
"example": "john@example.com",
|
||||
"description": "Clean email for display purposes"
|
||||
},
|
||||
"timeZone": {
|
||||
"type": "string",
|
||||
"example": "America/New_York"
|
||||
@@ -32247,9 +32264,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"required": [
|
||||
"name",
|
||||
"email",
|
||||
"displayEmail",
|
||||
"timeZone",
|
||||
"absent",
|
||||
"seatUid",
|
||||
@@ -33342,12 +33360,18 @@
|
||||
"email": {
|
||||
"type": "string",
|
||||
"example": "john.doe@example.com"
|
||||
},
|
||||
"displayEmail": {
|
||||
"type": "string",
|
||||
"example": "john.doe@example.com",
|
||||
"description": "Clean email for display purposes"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"email"
|
||||
"email",
|
||||
"displayEmail"
|
||||
]
|
||||
},
|
||||
"ReassignBookingOutput_2024_08_13": {
|
||||
|
||||
Reference in New Issue
Block a user