getUserRoles only fetches admins, moderator and owner badges never shown

Open
#1,288 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@swarnendusahu10-dotcom is already working on this.

Since Oct 29, 2026.

  • #1409 by @swarnendusahu10-dotcom — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Domain
api, frontend

Research direction

Start in packages/api/src/EmbeddedChatApi.ts:671-682 and trace how getUserRoles feeds memberStore.admins, then inspect packages/react/src/views/Message/MessageHeader.js:140 and :150 for global and room-scoped badges. Confirm the existing admin path and role data flow before making the change. Done means moderator and owner badges render for matching users while admin and room-scoped role badges still work.

Written by the indexing model from the issue text.

Description

getUserRoles() in EmbeddedChatApi.ts:671-682 hardcodes a single call to getUsersInRole("admin"). It never fetches moderators or owners. The result feeds into memberStore.admins, which MessageHeader.js:140 checks to show the "Admin" badge — but there's no equivalent for moderator or owner roles, so those badges never render.

async getUserRoles() {
  const response = await this.getUsersInRole("admin");
  if (response && response.success) {
    return { result: response.users };
  }
  return { result: [] };
}

The per-room roles from channels.roles / groups.roles API do get fetched separately and shown via channelLevelRoles in MessageHeader.js:150, so room-scoped roles work. But the global moderator/owner roles are just missing.

Steps to reproduce:
  1. Have a user with the "moderator" or "owner" role in a room
  2. Open EmbeddedChat in that room
  3. Look at messages from that user — no role badge appears
  4. Compare with a user who has "admin" role — the "Admin" badge shows
Expected behavior:

Moderator and owner roles should show badges next to the username, same as admin.

Actual behavior:

Only the "Admin" badge renders. Moderators and owners get no badge because their role data is never fetched.

Code reference:
  • packages/api/src/EmbeddedChatApi.ts:671-682 — only queries admin role
  • packages/react/src/views/Message/MessageHeader.js:140 — only checks admins array
Dominant language
JavaScript
Stars
171
Forks
421
Avg merge
3d 6h
Merged PRs (30d)
4

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RocketChat/EmbeddedChat

All issues in RocketChat/EmbeddedChat

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.