RocketChat / RocketChat/EmbeddedChat
getUserRoles only fetches admins, moderator and owner badges never shown
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 165
- Forks
- 381
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 1
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:
- Have a user with the "moderator" or "owner" role in a room
- Open EmbeddedChat in that room
- Look at messages from that user — no role badge appears
- 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 queriesadminrolepackages/react/src/views/Message/MessageHeader.js:140— only checksadminsarray
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
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.
Assessment
- Tech stack
- javascript, react, typescript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100