microsoft-graph-toolkit
microsoft-graph-toolkit copied to clipboard
[BUG] [MGT-CHAT] User name on Chat screen shows "Unknown" for EXTERNAL users
Describe the bug When the person you are chatting with is an external user (someone outside your domain), the user name is Unknown.
To Reproduce Steps to reproduce the behavior:
- Create a chat with an external user
- Observe that the title is not correct, but the name is included when receiving messages
Expected behavior I expect all chats to have a valid name.
Screenshots
Environment (please complete the following information):
- OS: macOS Monterey 12.7.3
- Browser: Edge
- Framework: React
- Context: Web
- Version: MGT 4
- Provider: Msal2Provider
Additional context I am a MSFT FTE and can be reached at pelasne in Teams.
Interesting, that suggests that there's some discrepancy between the data about the participants on the chat object versus the chat message.
Definitely needs investigation, but is something that we should try to resolve.
Findings:
This happens when the external user is not in the same AAD tenant as the current user, so we can't resolve the user object via calls to /users/{id}
On messages that are received via /chats/{chatId}/messages
and the associated change notification there is some basic information about the user that sent the message including the display name.
On the system event messages for adding/removing the user from the chat the displayName is not included.
However the /members
collection of the chat contains an entry for the external user with their userId, tenantId, and displayName.
Given this we could use that data to provide a resolved displayName for use in system messages. Similarly we could use this data to provide a personDetails to an mgt-person for the chat header