microsoft-graph-toolkit icon indicating copy to clipboard operation
microsoft-graph-toolkit copied to clipboard

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

Open plasne opened this issue 4 months ago • 2 comments

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

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

plasne avatar Feb 21 '24 17:02 plasne

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 avatar Feb 22 '24 17:02 gavinbarron

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

gavinbarron avatar Feb 27 '24 17:02 gavinbarron