microsoftgraph / microsoft-graph-toolkit

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

[BUG] person-card: buttons not working when using person-details #3229

Closed Rafaelki closed 1 day ago

Rafaelki commented 2 weeks ago

Describe the bug When the person component is defined using person-details, the buttons in the person-card for chat, video and call are visible but not working on click.

Screenshots image

To Reproduce Steps to reproduce the behavior:

  1. Go to the Microsoft Graph Toolkit Playground
  2. Add this component in the html tab, replacing ccdev1@fresh.onmicrosoft.com with a valid email of a user in your organization: <mgt-person person-details='{"displayName":"Frank Herbert1","jobTitle":"jobTitle","department":"department","id":"ccdev1@fresh.onmicrosoft.com"}' view="threelines" person-card="click" />
  3. Note that the person component renders the name, department and job title indecated in the person-details object. In the screenshot above the name is Frank Herbert1.
  4. Click the person component to open the person-card
  5. Note that the person name, department and job title inside the card have been resolved with the actual values of the user indicated in the "id" attribute. In the screenshot above the actual name is "Ruth Bader Ginsburg".
  6. Click the buttons chat, video and call and note that nothing happens.

Expected behavior

  1. chat, video and call buttons should work, opening the corresponding application
  2. buttons that are not going to work should not be visible

Environment (please complete the following information):

Workaround I found a workaround by adding the properties userPrincipalName and businessPhones in the person-details object, but this should not be necessary as they can be obtained when the actual name is resolved. I think this was the case in previous versions of MGT.

<mgt-person person-details='{"displayName":"Frank Herbert2","jobTitle":"jobTitle","department":"department","id":"ccdev1@fresh.onmicrosoft.com","userPrincipalName":"ccdev1@fresh.onmicrosoft.com","businessPhones":["1234"]}' view="threelines" person-card="click" />

Rafaelki commented 5 days ago

Hi, is there any update on this?

Getting Expected behavior 2: "buttons that are not going to work should not be visible" should not be complex, it is just amending the conditions around the buttons, eg. https://github.com/microsoftgraph/microsoft-graph-toolkit/blob/ab466977b05e8079f08cc63bf6a9600c98344751/packages/mgt-components/src/components/mgt-person-card/mgt-person-card.ts#L676 should not check by if (userPerson.userPrincipalName), it should check by if (hasPhone()). Note that hasPhone is a private function that is never called.

Mnickii commented 4 days ago

@Rafaelki we appreciate your patience on this, thank you for the bug report and clear steps for repro. This is a clear bug, a fix for it will be available in the next release at the end of this month.