Skip to content

getUserRoles only fetches admins, moderator and owner badges never shown #1288

@deepak0x

Description

@deepak0x

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions