Skip to content

fix(chat): "Start a private chat" menu option is still shown when chat is disabled - #23433

Merged
ramonlsouza merged 5 commits into
bigbluebutton:v3.0.x-releasefrom
JoVictorNunes:i-23371
Jun 30, 2025
Merged

ramonlsouza merged 5 commits into
bigbluebutton:v3.0.x-releasefrom
JoVictorNunes:i-23371

Conversation

@JoVictorNunes

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Fixes a bug where the "Start a private chat" user option is shown even though private chating is disabled through the disabledFeatures parameter.
  • Fixes the condition for bypassing disabledFeatures=privateChat when the group chat involves a moderator.

Closes Issue(s)

Closes #23371

How to test

See the linked issue.

@coderabbitai

coderabbitai Bot commented Jun 19, 2025 •

Copy link
Copy Markdown
Contributor

"""

Walkthrough

The changes modify the logic for handling private chat permissions in both backend Scala handlers and the frontend React component. In the backend, a new check is introduced to determine if any moderators are present in a private chat, allowing private chats with moderators even when private chat is generally disabled. In the frontend, the display logic for the "Start Private Chat" menu option is updated to depend on a dedicated private chat feature flag instead of the general chat enabled flag, ensuring the menu option is hidden when private chat is disabled.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant UI as UserActions Component
    participant Backend as Backend Handler

    User->>UI: Open user context menu
    UI->>UI: Check isPrivateChatEnabled
    alt Private chat enabled
        UI->>User: Show "Start Private Chat" option
        User->>Backend: Request to start private chat
        Backend->>Backend: Check if private chat allowed (mod presence and flags)
        alt Allowed
            Backend->>User: Private chat started
        else Not allowed
            Backend->>User: Private chat denied
        end
    else Private chat disabled
        UI->>User: Hide "Start Private Chat" option
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Hide "Start a private chat" menu option when chat or private chat is disabled (#23371) ✅
Prevent private chat initiation and message sending when chat/private chat is disabled (#23371) ✅

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Suggested labels

priority: high

Suggested reviewers

  • gabriellpr
  • ramonlsouza
    """
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f4e636 and 87c87d9.

📒 Files selected for processing (3)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/CreateGroupChatReqMsgHdlr.scala (3 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/SendGroupChatMessageMsgHdlr.scala (3 hunks)
  • bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-participants/user-actions/component.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: ts-code-compilation
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-webrtc)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-freeswitch)
  • GitHub Check: build-package (bbb-fsesl-akka)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-apps-akka)
  • GitHub Check: build-package (bbb-etherpad)
  • GitHub Check: build-package (bbb-config)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-export-annotations)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-learning-dashboard)
  • GitHub Check: ts-code-validation
  • GitHub Check: plugin-sdk-version-check
🔇 Additional comments (8)
bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-participants/user-actions/component.tsx (3)

29-29: LGTM: Added dedicated private chat feature flag hook.

The addition of useIsPrivateChatEnabled import provides the necessary hook to check private chat availability independently from general chat settings.


237-237: LGTM: Proper initialization of private chat enabled state.

The hook usage correctly retrieves the private chat enabled state that will be used in the permission logic.


397-404: Excellent fix: Now uses dedicated private chat feature flag.

The logic correctly shifts from using the general isChatEnabled flag to the specific isPrivateChatEnabled flag for controlling private chat menu visibility. This ensures the "Start Private Chat" option is properly hidden when private chat is disabled via disabledFeatures=privateChat, while still allowing moderators to bypass this restriction.

The updated logic maintains all existing behavior while fixing the core issue described in the PR.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/SendGroupChatMessageMsgHdlr.scala (2)

56-56: LGTM: Correctly tracks absence of moderators in private chats.

The logic properly sets hasModMembers = false when a private chat contains no moderators, which is used later to determine if private chat restrictions should be enforced.


65-65: LGTM: Implements moderator bypass for private chat restrictions.

The updated condition !(privateChatDisabled && !hasModMembers) correctly allows private chat messages when:

  • Private chat is not disabled, OR
  • Private chat is disabled but moderators are present in the chat

This aligns with the PR objective to bypass private chat restrictions when moderators are involved.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/CreateGroupChatReqMsgHdlr.scala (3)

37-44: LGTM: Proper moderator detection logic.

The code correctly:

  1. Filters the user list to find moderators using role checking
  2. Determines if moderators are present (modMembers.length == 0)
  3. Sets appropriate flags for chat locking and moderator presence

The logic aligns with the PR objective to allow private chat creation when moderators are involved.


55-55: LGTM: Implements moderator bypass for private chat creation.

The condition (privateChatDisabled && !hasModMembers) correctly prevents chat creation only when:

  • Private chat is disabled AND there are no moderators in the chat

This properly implements the moderator bypass feature described in the PR objectives.


25-25: Consider the initialization logic for hasModMembers.

Similar to the message handler, hasModMembers is initialized to true outside the user lookup. If the user is not found (the for comprehension doesn't execute), it remains true, potentially allowing chat creation even when it shouldn't be allowed.

Consider the same pattern as suggested for the message handler - initialize to false and explicitly set to true when appropriate.

-var hasModMembers: Boolean = true
+var hasModMembers: Boolean = false

Likely an incorrect or invalid review comment.

@antobinary antobinary added this to the Release 3.0 milestone Jun 19, 2025

@ramonlsouza ramonlsouza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with disabledFeatures=privateChat:

the "start a private chat" menu is still visible to moderators, but it doesn't work... when a moderator tries to start a chat with a viewer, the chat panel gets stuck in an infinite loading state.

if a viewer initiates the chat, the panel opens correctly, but the moderator can't reply... sending a message has no effect.

with disabledFeatures=chat:

the "start a private chat" option appears for everyone, but the panel opens without a message input, both for viewers and moderators.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-messages/chat-list/component.tsx (1)

87-87: Apply the static analysis suggestion for safer code.

The condition can be simplified using optional chaining as suggested by the static analysis tool.

-  if (allowedChats && allowedChats.length) {
+  if (allowedChats?.length) {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e33330e and b81c42b.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-messages/chat-list/component.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: jaapjansma
PR: bigbluebutton/bigbluebutton#21204
File: bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala:21-21
Timestamp: 2024-10-10T12:15:03.265Z
Learning: When reviewing code changes in BigBlueButton, particularly in case classes like `RegisterUser` in `MeetingsManagerActor.scala`, ensure to accurately distinguish between added parameters and replaced parameters to avoid incorrect assessments.
🧬 Code Graph Analysis (1)
bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-messages/chat-list/component.tsx (2)
bigbluebutton-html5/imports/ui/services/features/index.js (1)
  • useIsChatEnabled (31-33)
bigbluebutton-html5/imports/ui/components/user-list/service.js (1)
  • PUBLIC_GROUP_CHAT_ID (138-138)
🪛 Biome (1.9.4)
bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-messages/chat-list/component.tsx

[error] 87-87: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-graphql-server)
🔇 Additional comments (2)
bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-messages/chat-list/component.tsx (2)

11-11: Import looks good.

The import of useIsChatEnabled aligns with the feature flag approach described in the PR objectives.


83-86: Chat filtering logic is correctly implemented.

The implementation correctly distinguishes between general chat enablement and private chat permissions:

  • When chat is enabled: shows all chats
  • When chat is disabled: filters out public group chat but preserves private chats

This aligns with the PR objective to allow private chats with moderators even when general chat is disabled.

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@ramonlsouza
ramonlsouza merged commit 2b85791 into bigbluebutton:v3.0.x-release Jun 30, 2025
ramonlsouza pushed a commit that referenced this pull request Oct 28, 2026
…rivateChat is disabled

allowedToChatPrivately ended with `|| !userChatIsLocked`, so an attendee the
lock settings did not lock was offered a private chat with everyone, whatever
disabledFeatures=privateChat said. The server refuses that chat
(CreateGroupChatReqMsgHdlr only lets a private chat through when a moderator
is involved), so the attendee got an empty "Private Chat" tab and the message
went nowhere. 3.0 has hidden the option since #23433.

Keep the exemption for an attendee the moderator unlocked, but only while
private chat is enabled, and let the attendee-to-moderator option stand on the
server rule alone: a private chat with a moderator stays allowed while the
feature is disabled, so the option stays offered.

Closes #26229
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.

"Start a private chat" menu option is still shown when chat is disabled

3 participants