fix: reaction list shows blank entries when UI_Use_Real_Name is enabled

Merged
RO
3mo ago
+88-4

Proposed changes

Resolves real names for message reactions in the broadcast pipeline. When UI_Use_Real_Name is enabled, the server now enriches each reaction with a names array containing the display names of users who reacted.

Previously only the message author (message.u.name) and mentions (mentions[].name) were resolved. This change extends the same pattern to reactions using a batch query (Users.findByUsernames) instead of per-username lookups.

Issue(s)

https://rocketchat.atlassian.net/browse/NATIVE-1047

Steps to test or reproduce

Web

  1. Enable UI_Use_Real_Name in admin settings
  2. Hover over a reaction to see the tooltip — real names should appear instead of usernames
  3. Click the reaction list from the message menu — real names should be displayed

Mobile app

  1. Open any channel in the mobile app
  2. React to any message
  3. Long-press a reaction to open the reaction list
  4. It should display names instead of blank entries

Note: Current behaviour differs by platform:

  • Web: Usernames are shown instead of real names.
  • Mobile: The reaction list shows blank entries.

Further comments

Uses a single batch query (Users.findByUsernames) to resolve all reaction usernames at once, deduplicated via Set, with a fallback to username when a user has no display name set.

Summary by CodeRabbit

Summary by CodeRabbit

  • Enhancements
    • Reaction items in broadcast messages are now enriched with users’ display names when the real-name setting is enabled.
    • Uses a batch lookup to resolve reaction usernames to display names (falling back to the original username when no match is found).
  • Bug Fixes
    • Fixes incorrect, blank, or username-only reaction entries in the reaction list modal when real-name display is enabled (especially on mobile).
  • Tests
    • Added unit test coverage for reaction name resolution under the real-name setting, including ensuring the lookup is skipped when reactions are empty.