Skip to content

feat: add senderRole to useLoadedChatMessages - #281

Open
GuiLeme wants to merge 1 commit into
bigbluebutton:v0.0.xfrom
GuiLeme:add-property-loaded-chat-messages
Open

feat: add senderRole to useLoadedChatMessages#281
GuiLeme wants to merge 1 commit into
bigbluebutton:v0.0.xfrom
GuiLeme:add-property-loaded-chat-messages

Conversation

@GuiLeme

@GuiLeme GuiLeme commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Add senderRole to useLoadedChatMessages

Exposes the sender's role as it was at the moment the message was sent. Unlike the role available through useUsersBasicInfo / useLoadedUserList, this value is static: it does not change if the user is promoted/demoted later, and it survives the user leaving the meeting.

If you have suggestions for additional properties that should be included, feel free to leave a comment below.

This could be useful for addressing security concerns related to message authenticity. For example, if a user leaves the session and all we have is their userId (the previous scenario), we have no reliable way to determine whether a message was originally sent by a moderator.

Changes

  • LoadedChatMessage gains senderRole: string | null:

    export interface LoadedChatMessage {
      createdAt: string;
      message: string;
      messageId: string;
      senderUserId: string;
      // Static throughout the meeting; null for system messages
      senderRole: string | null;
      messageMetadata: string;
    }
  • Fixed the chat example in the README, which referenced msg.senderName — a field that does not exist on LoadedChatMessage.

Why nullable

senderRole is null for system messages (welcome message, moderator-only message, chat-cleared), which have no sender:

  • ChatMessageDAO.insertSystemMsg inserts with senderRole = None
  • bbb_schema.sql declares "senderRole" varchar(20) with no NOT NULL

These messages are returned by the same chat page query, so plugins will see them.

More

PR Closely related: bigbluebutton/bigbluebutton#25539

…hat messages hook (it remains static throughout the meeting)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant