Code Review Bench PR #25593 - fix(api): return original email without OAuth suffix in bookings#4
Open
tomerqodo wants to merge 2 commits intobase_pr_25593_20260125_7837from
Open
Conversation
This was referenced Jan 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code Review Bench PR calcom#25593
Original PR Title: fix(api): return original email without OAuth suffix in bookings
Original PR Description: ## What does this PR do?
This PR fixes a bug in API v2 (2024-08-13) where emails in booking API responses contained the OAuth client ID as a suffix (
+{cuid}). This suffix exists to prevent email collisions between managed users of different OAuth clients.Fixes calcom#25494 | Linear: CAL-6843
Problem:
bob+cmidditrv0000mza4q93hbcau@example.combob@example.comSolution:
To avoid breaking changes for platform customers who may rely on the original email format, we preserve the original
emailfield and add a newdisplayEmailfield with the CUID suffix removed.Key Changes:
getDisplayEmail()helper to strip CUID suffix from emailsdisplayEmailfield to all relevant response objectsemailfield unchanged for backwards compatibilityRegex pattern used:
/\+[a-zA-Z0-9]{25}/(CUID format, consistent withgoogle-calendar.service.ts)Affected Fields
hosts[].emailbob+{cuid}@example.com(unchanged)hosts[].displayEmailbob@example.com(new)attendees[].emailbob+{cuid}@example.com(unchanged)attendees[].displayEmailbob@example.com(new)bookingFieldsResponses.emailbob+{cuid}@example.com(unchanged)bookingFieldsResponses.displayEmailbob@example.com(new)bookingFieldsResponses.guests[]guest+{cuid}@example.com(unchanged)bookingFieldsResponses.displayGuests[]guest@example.com(new)reassignedTo.emailbob+{cuid}@example.com(unchanged)reassignedTo.displayEmailbob@example.com(new)How should this be tested?
Test Scenario 1 - Managed user as HOST:
GET /v2/bookings/{uid}with headerCal-Api-Version: 2024-08-13hosts[].emailreturns original email with suffixhosts[].displayEmailreturns email without suffixTest Scenario 2 - Managed user as ATTENDEE:
GET /v2/bookings/{uid}with headerCal-Api-Version: 2024-08-13attendees[].emailreturns original email with suffixattendees[].displayEmailreturns email without suffixTest Scenario 3 - Self-booking:
emailanddisplayEmailfields are present and correctExpected result:
emailfields preserve original value,displayEmailfields return clean email without+{cuid}suffixMandatory Tasks (DO NOT REMOVE)
Human Review Checklist
/\+[a-zA-Z0-9]{25}/correctly strips CUID suffixes without affecting normal emailsemailfield values are unchangeddisplayEmailis added to all booking output types (hosts, attendees, reassignedTo)Original PR URL: calcom#25593