Repository navigation
fix(chat): "Start a private chat" menu option is still shown when chat is disabled - #23433
Conversation
|
""" WalkthroughThe 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
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Suggested labels
Suggested reviewers
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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
useIsPrivateChatEnabledimport 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
isChatEnabledflag to the specificisPrivateChatEnabledflag for controlling private chat menu visibility. This ensures the "Start Private Chat" option is properly hidden when private chat is disabled viadisabledFeatures=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 = falsewhen 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:
- Filters the user list to find moderators using role checking
- Determines if moderators are present (
modMembers.length == 0)- 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,
hasModMembersis initialized totrueoutside the user lookup. If the user is not found (theforcomprehension doesn't execute), it remainstrue, potentially allowing chat creation even when it shouldn't be allowed.Consider the same pattern as suggested for the message handler - initialize to
falseand explicitly set totruewhen appropriate.-var hasModMembers: Boolean = true +var hasModMembers: Boolean = falseLikely an incorrect or invalid review comment.
ramonlsouza
left a comment
There was a problem hiding this comment.
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.
|
There was a problem hiding this comment.
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
📒 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
useIsChatEnabledaligns 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.
Automated tests Summary✅ All the CI tests have passed! |
…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



What does this PR do?
disabledFeaturesparameter.disabledFeatures=privateChatwhen the group chat involves a moderator.Closes Issue(s)
Closes #23371
How to test
See the linked issue.