From d5d44fb64bac3afaaab2876bcf8e277993153ae4 Mon Sep 17 00:00:00 2001 From: chauhan_s Date: Sat, 20 Sep 2025 14:58:27 +0530 Subject: [PATCH] fix: remove platform client ID from attendee list when adding team members as attendee in a team event (#23866) Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> --- packages/lib/formatCalendarEvent.ts | 15 ++++++++++++--- packages/platform/atoms/hooks/useOAuthFlow.ts | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/lib/formatCalendarEvent.ts b/packages/lib/formatCalendarEvent.ts index bfdd36301d..a9e8482efe 100644 --- a/packages/lib/formatCalendarEvent.ts +++ b/packages/lib/formatCalendarEvent.ts @@ -14,14 +14,23 @@ const formatClientIdFromEmails = (calEvent: CalendarEvent | ExtendedCalendarEven ...calEvent.organizer, email: calEvent.organizer.email.replace(`+${clientId}`, ""), }; - return [attendees, organizer]; + const team = calEvent.team + ? { + ...calEvent.team, + members: calEvent.team.members.map((member) => ({ + ...member, + email: member.email.replace(`+${clientId}`, ""), + })), + } + : undefined; + return [attendees, organizer, team]; }; export const formatCalEvent = (calEvent: CalendarEvent) => { const clonedEvent = cloneDeep(calEvent); if (clonedEvent.platformClientId) { - const [attendees, organizer] = formatClientIdFromEmails(clonedEvent, clonedEvent.platformClientId); - Object.assign(clonedEvent, { attendees, organizer }); + const [attendees, organizer, team] = formatClientIdFromEmails(clonedEvent, clonedEvent.platformClientId); + Object.assign(clonedEvent, { attendees, organizer, team }); } return clonedEvent; diff --git a/packages/platform/atoms/hooks/useOAuthFlow.ts b/packages/platform/atoms/hooks/useOAuthFlow.ts index d9ff7bed8b..5c01471efa 100644 --- a/packages/platform/atoms/hooks/useOAuthFlow.ts +++ b/packages/platform/atoms/hooks/useOAuthFlow.ts @@ -42,7 +42,7 @@ export const useOAuthFlow = ({ accessToken, refreshUrl, clientId, onError, onSuc setIsRefreshing(false); } - return Promise.reject(err.response); + return Promise.reject(err); }) : "";