refactor: resolve a user's roles split by workspace and room scope

Merged
GG
18d ago
+95-34

Proposed changes (including videos or screenshots)

Replaces useMessageRoles, which merged a user's workspace and room roles into a single list for the message header, with useUserRolesByScope, which returns { workspaceRoles, roomRoles } separately. The message header still shows both together, so there's no layout change here; the split is what the user information redesign builds on (one collapsed role tag per scope, room roles on the card).

No visible change: roles are still labelled by their description (the role endpoints only return roles that have one).

Extracted from #41650 (user information redesign), where @ivans-netto wrote this hook. Stacked on #42506; #41650 is stacked on top.

Issue(s)

CORE-1962

Steps to test or reproduce

  1. Enable "Display roles" and post as a user with a workspace role (e.g. admin) and a room role (e.g. owner): both still show in the message header.

Further comments

useUserRolesByScope.spec.ts covers the split by scope.

Summary by CodeRabbit

  • Updates
    • Message headers display applicable role labels from both workspace and room roles. Roles without descriptions are omitted, and existing visibility rules determine when labels appear.
  • Bug Fixes
    • Local time now displays correctly on user cards, the user info panel, and OAuth authorization cards for UTC+0 and fractional UTC offsets. The stray β€œ0” in the user info panel is also removed.