microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
964 stars 309 forks source link

[BUG] [MGT-CHAT] User name on Chat screen shows "Unknown" for EXTERNAL users #3061

Open plasne opened 9 months ago

plasne commented 9 months ago

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:

  1. Create a chat with an external user
  2. 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 image

Environment (please complete the following information):

Additional context I am a MSFT FTE and can be reached at pelasne in Teams.

gavinbarron commented 9 months ago

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.

gavinbarron commented 9 months ago

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