Skip to content

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

Closed
wants to merge 8 commits into from

Conversation

prabhjot-msft
Copy link
Contributor

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

  • I have updated the project documentation to reflect my changes if necessary.
  • I have read the CONTRIBUTING documentation.

Is this a breaking change?

  • This change causes current functionality to break.

Copy link
Contributor

github-actions bot commented Jul 8, 2025

📦 Chat bundle size

Bundle Base Size (bytes) Current Size (bytes) Change Delta (bytes)
build.bundle.js 1779775 1780321 ⚠️ increased 546
110.bundle.js 365689 365689 ➖ unchanged 0
450.bundle.js 4455 4455 ➖ unchanged 0
82.bundle.js 28303 28303 ➖ unchanged 0
91.bundle.js 4104 4104 ➖ unchanged 0

Total change: +546 B ⚠️

Copy link
Contributor

github-actions bot commented Jul 8, 2025

📦 CallWithChat bundle size

Bundle Base Size (bytes) Current Size (bytes) Change Delta (bytes)
build.bundle.js 7580094 7580780 ⚠️ increased 686
398.bundle.js 12413574 12413574 ➖ unchanged 0
399.bundle.js 362421 362421 ➖ unchanged 0
450.bundle.js 4471 4471 ➖ unchanged 0
82.bundle.js 28319 28319 ➖ unchanged 0
91.bundle.js 4120 4120 ➖ unchanged 0

Total change: +686 B ⚠️

Copy link
Contributor

github-actions bot commented Jul 8, 2025

📦 Calling bundle size

Bundle Base Size (bytes) Current Size (bytes) Change Delta (bytes)
build.bundle.js 6604592 6604592 ➖ unchanged 0
398.bundle.js 12413560 12413560 ➖ unchanged 0

Total change: +0 B ➖

Copy link
Contributor

github-actions bot commented Jul 8, 2025

Copy link
Contributor

Copy link
Contributor

for (const message of Object.values(chatMessages)) {
if (message?.sender) {
const senderId =
message.sender.kind === 'microsoftTeamsUser' && message.sender.rawId
Copy link
Member

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

Copy link
Contributor

@mgamis-msft mgamis-msft Jul 25, 2025

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?

}
}
}
};
Copy link
Contributor

@mgamis-msft mgamis-msft Jul 25, 2025

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants