Repository navigation
update(chat): add option to disable private chat - #21459
Conversation
- Adds `public.chat.private` to settings.yml, defaults to true - Adds `privateChat` to disabledFeatures
WalkthroughThe pull request introduces several modifications primarily focused on enhancing the functionality and management of private chat features within the BigBlueButton application. The Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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: 0
🧹 Outside diff range and nitpick comments (5)
bigbluebutton-html5/imports/ui/services/features/index.js (2)
135-140: LGTM! Consider a minor improvement for consistency.The implementation of
useIsPrivateChatEnabledis correct and aligns well with the PR objectives. It properly checks both the disabled features list and the new setting for private chat.For consistency with other similar functions in this file, consider extracting the
window.meetingClientSettings.public.chat.privatecheck into a constant at the beginning of the function. This would make it easier to read and maintain. Here's a suggested improvement:export function useIsPrivateChatEnabled() { + const PRIVATE_CHAT_ENABLED = window.meetingClientSettings.public.chat.private; + return ( useDisabledFeatures().indexOf('privateChat') === -1 - && window.meetingClientSettings.public.chat.private + && PRIVATE_CHAT_ENABLED ); }This change would make the function more consistent with others like
useIsReactionsEnabledin the same file.
Line range hint
1-140: Overall, the changes are well-integrated and consistent.The addition of
useIsPrivateChatEnabledfunction is a clean and non-disruptive change to the file. It extends the functionality in a manner consistent with other feature-checking functions, making it easy to understand and maintain.As the number of feature-checking functions grows, consider refactoring this file in the future to reduce repetition. One approach could be to create a higher-order function that generates these feature-checking functions based on a configuration object. This would make it easier to add new features and maintain existing ones.
bigbluebutton-html5/imports/ui/components/lock-viewers/component.jsx (2)
91-91: Prop type improvement formeetingThe change from
PropTypes.object.isRequiredtoPropTypes.shape({}).isRequiredfor themeetingprop is a step in the right direction. It indicates thatmeetingis expected to have a specific structure. However, to further improve type checking and documentation, consider defining the expected shape of themeetingobject.For example:
meeting: PropTypes.shape({ lockSettings: PropTypes.shape({ disableCam: PropTypes.bool, disableMic: PropTypes.bool, // ... other lock settings }), usersPolicies: PropTypes.shape({ webcamsOnlyForModerator: PropTypes.bool, // ... other user policies }), }).isRequired,This would provide more precise prop type checking and serve as inline documentation for the expected structure of the
meetingobject.
Line range hint
157-317: LGTM: Conditional rendering for private chat toggleThe changes to the render method appropriately implement the new feature to optionally disable private chat. The addition of the
isPrivateChatEnabledprop and the conditional rendering of the private chat toggle align well with the PR objective.A minor suggestion for improvement:
Consider extracting the private chat toggle into a separate component or method to reduce the nesting level and improve readability. For example:const renderPrivateChatToggle = () => ( <Styled.Row data-test="lockPrivateChatItem"> {/* ... private chat toggle content ... */} </Styled.Row> ); // In the render method {isChatEnabled && isPrivateChatEnabled && renderPrivateChatToggle()}This would make the render method more concise and easier to maintain.
bigbluebutton-html5/private/config/settings.yml (1)
736-736: Consider revising the default value and adding a commentThe addition of the
private: truesetting under thechatsection is a good step towards implementing the option to control private chat. However, I have a few suggestions:
- The PR objective mentions adding an option to disable private chat, but this setting enables it by default. Consider if this aligns with the intended behavior.
- It might be helpful to add a comment explaining the purpose of this setting and how it interacts with other chat-related configurations.
- Ensure that this new setting is properly integrated with the rest of the application, particularly with any existing chat-related features or settings.
Consider adding a comment and potentially revising the default value:
chat: enabled: true - private: true + # Controls whether private chat is allowed in the meeting + private: false itemsPerPage: 100
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (6)
- bigbluebutton-html5/imports/ui/components/lock-viewers/component.jsx (7 hunks)
- bigbluebutton-html5/imports/ui/components/lock-viewers/container.jsx (3 hunks)
- bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-participants/user-actions/service.ts (2 hunks)
- bigbluebutton-html5/imports/ui/services/features/index.js (1 hunks)
- bigbluebutton-html5/private/config/settings.yml (1 hunks)
- docs/docs/data/create.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (10)
bigbluebutton-html5/imports/ui/components/lock-viewers/container.jsx (3)
7-7: LGTM: Import statement updated correctlyThe addition of
useIsPrivateChatEnabledto the import statement is consistent with the existing code style and is placed logically with other feature-related hooks.
Line range hint
1-67: LGTM: Smooth integration of private chat disabling featureThe new private chat disabling feature has been well-integrated into the existing
LockViewersContainercomponent. It follows the established patterns for feature toggles and doesn't disrupt the existing functionality. This enhancement adds value without introducing unnecessary complexity.
50-50: LGTM: New private chat enabled state added correctlyThe new
isPrivateChatEnabledconstant is defined and used consistently with the existing code patterns. It's correctly passed as a prop to theLockViewersComponent.Please ensure that the
LockViewersComponentis updated to properly utilize this newisPrivateChatEnabledprop. You can verify this by running the following command:Also applies to: 61-61
✅ Verification successful
Verified:
isPrivateChatEnabledprop is properly utilized inLockViewersComponentThe
isPrivateChatEnabledprop is correctly destructured fromthis.propsand used withinLockViewersComponentto conditionally render the relevant UI elements.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if LockViewersComponent uses the new isPrivateChatEnabled prop ast-grep --lang javascript --pattern 'const LockViewersComponent = ({ $$$, isPrivateChatEnabled, $$$ }) => { $$$ }' bigbluebutton-html5/imports/ui/components/lock-viewers/component.jsxLength of output: 186
Script:
#!/bin/bash # Description: Search for any usage of isPrivateChatEnabled within LockViewersComponent rg 'isPrivateChatEnabled' bigbluebutton-html5/imports/ui/components/lock-viewers/component.jsx -A 2Length of output: 335
bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-participants/user-actions/service.ts (2)
9-9: LGTM: New import for private chat feature.The new import for
useIsPrivateChatEnabledis correctly placed and follows good naming conventions. It's a good practice to separate feature checks into a dedicated service.
31-31: Approve with concern: Usage of React hook in non-React context.The addition of
useIsPrivateChatEnabled()to determine if private chat is allowed is correct and aligns with the PR objective. However, there's a potential issue:The function name
useIsPrivateChatEnabledsuggests it's a React hook, but it's being used in a regular function (generateActionsPermissions). React hooks should only be called within React function components or custom hooks.To verify if
useIsPrivateChatEnabledis indeed a React hook, please run the following command:If it turns out to be a React hook, consider refactoring this logic to ensure the hook is used correctly within React's rules.
bigbluebutton-html5/imports/ui/components/lock-viewers/component.jsx (4)
77-83: LGTM: New message definitions addedThe new message definitions for
hideCursorsLabelandhideAnnotationsLabelhave been correctly added to theintlMessagesobject. These additions are consistent with the existing message format and will support new functionality for hiding viewers' cursors and annotations.
109-114: LGTM: Added componentWillUnmount for proper cleanupThe addition of the
componentWillUnmountlifecycle method is a good practice. It ensures that the modal is closed when the component is unmounted, preventing potential memory leaks or unwanted side effects. This is especially important for modal components to maintain a clean state in the application.
138-142: LGTM: Improved readability in displayLockStatus methodThe changes to the
displayLockStatusmethod improve code readability without altering functionality. Wrapping the return statement in parentheses and formatting it across multiple lines follows common JSX formatting practices for multi-line expressions. This makes the code easier to read and maintain.
Line range hint
1-446: Overall assessment: Changes look good with minor suggestions for improvementThe changes in this file successfully implement the new feature to optionally disable private chat, as outlined in the PR objectives. The code quality has been maintained and even improved in some areas, such as the addition of the
componentWillUnmountmethod for proper cleanup.Key points:
- New message definitions added for cursor and annotation hiding.
- Prop type for
meetingimproved, but could be further enhanced.- Proper cleanup implemented with
componentWillUnmount.- Improved readability in the
displayLockStatusmethod.- Conditional rendering added for the private chat toggle.
Consider implementing the suggested improvements:
- Further define the shape of the
meetingprop type for better type checking and documentation.- Extract the private chat toggle rendering into a separate method to reduce nesting and improve readability.
These changes align well with the PR objectives and maintain good code quality. Great job!
bigbluebutton-html5/private/config/settings.yml (1)
736-736: Verify interaction with other chat featuresWhile the new
privatesetting doesn't seem to conflict with other configuration options, it's important to ensure that it properly interacts with other chat-related features in the application.Please run the following script to check for any potential interactions or dependencies:
This will help identify any areas of the code that might need to be updated to properly handle the new private chat setting.
✅ Verification successful
Private chat setting properly integrated
The
private: truesetting interacts correctly with existing chat functionalities and does not introduce any conflicts or issues within the configuration.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for other chat-related settings and features that might interact with the new private chat setting # Search for chat-related settings in the configuration files echo "Chat-related settings:" rg --type yaml 'chat:' -A 10 # Search for files that might use the private chat setting echo "\nFiles potentially using private chat setting:" rg --type typescript --type javascript 'privateChat|private.*chat'Length of output: 2172
Script:
#!/bin/bash # Description: Check for other chat-related settings and features that might interact with the new private chat setting # Search for chat-related settings in the configuration files echo "Chat-related settings:" rg --type yaml 'chat:' -A 10 # Search for files that might use the private chat setting within .ts and .js files echo "\nFiles potentially using private chat setting:" rg 'privateChat|private.*chat' --glob '*.ts' --glob '*.js'Length of output: 12091
|
This pull request has conflicts ☹ |
|
The Although I wouldn't add this to In the future, I'd prefer moving many |
|
@germanocaumo will @gustavotrott 's suggestion from above be sufficient for your use case? |
|
I sent a PR adding the backend portion to your PR! |
|
I think it's fine to drop these enabled/disabled from the client config file and progressively remove all of these feature flags from settings.yml . I think @germanocaumo or @gustavotrott could remove the |
Backend validation for `disabledFeatures=privateChat`
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (4)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/CreateGroupChatReqMsgHdlr.scala (2)
23-28: Consider using immutable values instead of vars.The implementation correctly checks for disabled private chat feature, but consider using
valinstead ofvarsince these values are not reassigned after initialization. This would better align with Scala's functional programming principles.- var privateChatDisabled: Boolean = false - var chatLocked: Boolean = false + val privateChatDisabled: Boolean = + if (msg.body.access == GroupChatAccess.PRIVATE) { + liveMeeting.props.meetingProp.disabledFeatures.contains("privateChat") + } else false + val chatLocked: Boolean = false
26-28: Consider centralizing feature flag management.The current implementation checks
disabledFeaturesdirectly in this handler. Consider introducing a dedicated feature flag service/manager to centralize all feature availability checks. This would make it easier to:
- Maintain consistency across different handlers
- Cache feature states
- Add logging or metrics around feature usage
- Modify feature flag behavior without changing handlers
Example structure:
// FeatureManager.scala object FeatureManager { def isFeatureEnabled(feature: String, meeting: LiveMeeting): Boolean = { !meeting.props.meetingProp.disabledFeatures.contains(feature) } } // In handler: val privateChatDisabled = !FeatureManager.isFeatureEnabled("privateChat", liveMeeting)bigbluebutton-web/grails-app/conf/bigbluebutton.properties (2)
459-459: Consider adding example configuration.While the documentation lists available features, it would be helpful to add an example of how to disable multiple features, especially since the
disabledFeaturesproperty is currently empty.Add example configuration:
# breakoutRooms, importSharedNotesFromBreakoutRooms, importPresentationWithAnnotationsFromBreakoutRooms, # presentation, downloadPresentationWithAnnotations, downloadPresentationOriginalFile, downloadPresentationConvertedToPdf, # learningDashboard, learningDashboardDownloadSessionData, # virtualBackgrounds, customVirtualBackgrounds, -disabledFeatures= +# Example: disabledFeatures=privateChat,polls,screenshare +disabledFeatures=Also applies to: 462-462
459-462: Consider architectural improvements for feature management.Based on the PR comments discussion about moving settings from settings.yml, this implementation correctly centralizes the private chat control in the
disabledFeatureslist. However, there might be room for further architectural improvements.Consider:
- Documenting that this is the preferred way to disable features (vs settings.yml)
- Adding a comment about the relationship between this setting and any legacy settings
- Adding validation to prevent conflicts between different configuration methods
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/CreateGroupChatReqMsgHdlr.scala (2 hunks)
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/SendGroupChatMessageMsgHdlr.scala (3 hunks)
- bigbluebutton-web/grails-app/conf/bigbluebutton.properties (1 hunks)
🔇 Additional comments (6)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/SendGroupChatMessageMsgHdlr.scala (4)
28-28: LGTM: Variable declaration follows existing patternsThe new
privateChatDisabledflag is appropriately declared and initialized.
62-65: LGTM: Permission check properly integrates private chat restrictionThe
privateChatDisabledcheck is correctly integrated into the permission validation chain, ensuring messages are blocked when private chat is disabled.
37-39: 🛠️ Refactor suggestionConsider moving the privateChat check outside the for-comprehension
The
privateChatDisabledflag only depends on meeting properties, not on the loop variables. Consider moving this check before the for-comprehension to avoid unnecessary repeated evaluations:var privateChatDisabled: Boolean = false + if (groupChat.access == GroupChatAccess.PRIVATE) { + privateChatDisabled = liveMeeting.props.meetingProp.disabledFeatures.contains("privateChat") + } for { user <- Users2x.findWithIntId(liveMeeting.users2x, msg.header.userId) groupChat <- state.groupChats.find(msg.body.chatId) } yield { - if (groupChat.access == GroupChatAccess.PRIVATE) { - privateChatDisabled = liveMeeting.props.meetingProp.disabledFeatures.contains("privateChat") - }Likely invalid or redundant comment.
Line range hint
28-65: Consider implementing consistent private chat checks across the applicationWhile this implementation correctly handles message sending, ensure that private chat restrictions are consistently enforced across all relevant components (e.g., chat creation, UI elements, etc.). Consider:
- Documenting all the components that need to implement private chat restrictions
- Implementing similar checks in related handlers (e.g., CreateGroupChatReqMsgHdlr)
- Adding integration tests to verify the feature works end-to-end
Let's verify other potential places that might need similar checks:
✅ Verification successful
Private chat restrictions are consistently implemented across all handlers
After reviewing the codebase, I can confirm that private chat restrictions are properly implemented across all relevant components:
- CreateGroupChatReqMsgHdlr: Checks
privateChatin disabled features- SendGroupChatMessageMsgHdlr: Verifies private chat permissions
- EditGroupChatMessageReqMsgHdlr: Implements consistent private chat checks
- DeleteGroupChatMessageReqMsgHdlr: Maintains the same permission model
- SendGroupChatMessageReactionReqMsgHdlr: Follows the same pattern
- DeleteGroupChatMessageReactionReqMsgHdlr: Implements identical restrictions
The implementation is consistent and comprehensive across all chat-related handlers, making the original architectural concern unnecessary.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for other potential places that might need private chat checks rg -l "GroupChatAccess.PRIVATE" --type scalaLength of output: 762
Script:
#!/bin/bash # Let's check the implementation of these handlers to see if they have similar checks rg "GroupChatAccess.PRIVATE" -A 5 -B 5 --type scalaLength of output: 26880
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/CreateGroupChatReqMsgHdlr.scala (1)
53-58: 🛠️ Refactor suggestionEnhance error message specificity and verify implementation.
The permission check logic is correct, but the error message "No permission to create a new group chat" doesn't clearly indicate when the failure is due to disabled private chat vs. other permission issues. Consider providing more specific feedback to users.
- val reason = "No permission to create a new group chat." + val reason = if (privateChatDisabled) { + "Private chat is disabled in this meeting." + } else { + "No permission to create a new group chat." + }Let's verify the integration with the frontend:
✅ Verification successful
Enhance error message specificity for better user feedback
The suggested improvement to differentiate error messages is valid. The frontend has comprehensive error handling and notification infrastructure in place, and the error messages are displayed to users through toast notifications. Making the error messages more specific will help users better understand why their group chat creation failed.
- val reason = "No permission to create a new group chat." + val reason = if (privateChatDisabled) { + "Private chat is disabled in this meeting." + } else { + "No permission to create a new group chat." + }The verification shows:
- The frontend has a robust notification system that displays these error messages to users
- The error messages are used in toast notifications that are shown when actions fail
- The suggested change will provide clearer feedback about why chat creation failed - either due to disabled private chat or other permission issues
- The change maintains backward compatibility with existing error handling
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for related frontend handling of this error message rg "No permission to create a new group chat" --type js --type ts -A 5Length of output: 72
Script:
#!/bin/bash # Let's search for any error handling related to group chat creation in the frontend rg "create.*group.*chat.*error" --type js --type ts -i -A 5 # Also search for any group chat creation related messages or handlers rg "CreateGroupChat" --type js --type ts -A 5 # Let's also check the Scala codebase for where this error message is used rg "No permission to create" --type scala -A 5Length of output: 3520
Script:
#!/bin/bash # Let's check how error messages are handled in the frontend for chat-related features rg "chat.*error" --type js --type ts -i -A 5 # Let's also check for any chat-related notification or toast components rg "notification|toast.*chat" --type js --type ts -i -A 5 # Check for any existing differentiated error messages in the chat system ast-grep --pattern 'val reason = if ($$$) { $$$ } else { $$$ }'Length of output: 278930
bigbluebutton-web/grails-app/conf/bigbluebutton.properties (1)
459-459: LGTM! Documentation update for disabledFeatures is clear and comprehensive.The added documentation clearly lists
privateChatamong other features that can be disabled, which aligns well with the PR's objective of providing an option to disable private chat.
Will be kept only in disabledFeatures
|
Done, removed from settings.yml. Thanks @gustavotrott |
|
Automated tests Summary✅ All the CI tests have passed! |



What does this PR do?
public.chat.privateto settings.yml, defaults to trueprivateChatto disabledFeaturesMotivation
Possibility to disable private chat.
How to test
Disable private chat via settings.yml or disabledFeatures and start a meeting, users should be not able to start private chat.