-
Notifications
You must be signed in to change notification settings - Fork 77
Fix for OnFetchProfile display name in chat for Teams user #5924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📦 Chat bundle size
Total change: +546 B |
📦 CallWithChat bundle size
Total change: +686 B |
📦 Calling bundle size
Total change: +0 B ➖ |
Storybook 8 URL https://60c7ae6891f0e90039d7cd54-yafjpwoznd.chromatic.com/ |
Storybook 8 URL https://60c7ae6891f0e90039d7cd54-qwzldzydoc.chromatic.com/ |
Storybook 8 URL https://60c7ae6891f0e90039d7cd54-qtooizloss.chromatic.com/ |
packages/react-composites/src/composites/ChatComposite/adapter/OnFetchProfileCallback.ts
Show resolved
Hide resolved
for (const message of Object.values(chatMessages)) { | ||
if (message?.sender) { | ||
const senderId = | ||
message.sender.kind === 'microsoftTeamsUser' && message.sender.rawId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to simplify this ternary? its really hard to follow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a helper function getSenderId(message)
and use a series of if
statements that return early in that helper function?
} | ||
} | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: As an optimization, instead of a for loop in a for loop, we can make a map with senderId as keys and display name as values and then loop through each participant by checking the map for a display name.
Right now it is O(P x M) were P is the number of participants and M is the number of messages. With this optimization, it would improve to O(P + M).
What
Fix for OnFetchProfile display name in chat for Teams user
Why
https://skype.visualstudio.com/SPOOL/_workitems/edit/4171189
How Tested
Process & policy checklist
Is this a breaking change?