Repository navigation
feat(client): Include moderators when randomly assigning users to breakout rooms if all remaining users are moderators - #25120
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis pull request updates breakout room random assignment to distinguish between unassigned viewers, unassigned moderators, and fully assigned rooms. Sequence Diagram(s)sequenceDiagram
participant SidebarCreateBreakout
participant RoomManagmentState
participant AssignmentEffect
SidebarCreateBreakout->>RoomManagmentState: randomlyAssignModeratorsFunction / resetAssignmentsFunction
RoomManagmentState->>RoomManagmentState: randomlyAssignModerators
RoomManagmentState->>AssignmentEffect: rooms[0]?.users changes
AssignmentEffect->>SidebarCreateBreakout: onAssignmentStateChange(allAssigned|onlyModerators|hasViewers)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the breakout-room creation UI to support a third “random assignment” state: when the only remaining unassigned users are moderators, the UI offers to randomly assign moderators (instead of appearing to do nothing), and switches to an “unassign” state once everyone is assigned.
Changes:
- Adds new i18n strings for “Assign viewers randomly” / “Assign moderators randomly” and updated descriptions.
- Replaces the old
randomlyAssignedboolean with a 3-stateassignmentStatedriving the assign/unassign button behavior in the sidebar UI. - Implements
randomlyAssignModeratorsinRoomManagmentStateand reports assignment-state changes back to the parent.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| bigbluebutton-html5/public/locales/en.json | Adds/updates strings for the new 3-state random assignment UX. |
| bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/styles.ts | Extends the styled button prop typing to include tooltip/label/test attributes. |
| bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/component.tsx | Introduces assignmentState and wires the button to viewer/moderator/random/unassign actions. |
| bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/room-managment-state/component.tsx | Adds moderator-only random assignment and emits assignment-state changes based on the unassigned list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const [leastOneUserIsValid, setLeastOneUserIsValid] = useState(false); | ||
| const [roomPresentations, setRoomPresentations] = useState<RoomPresentations>([]); | ||
| const [randomlyAssigned, setRandomlyAssigned] = useState(false); | ||
| const [assignmentState, setAssignmentState] = useState<'hasViewers' | 'onlyModerators' | 'allAssigned'>('hasViewers'); |
There was a problem hiding this comment.
With hardcoded hasViewers, will not cause on a mod only meeting. start the button with a initial wrong state?
| /> | ||
| {(() => { | ||
| let assignBtnLabel: string; | ||
| let assignBtnTooltip: string; |
There was a problem hiding this comment.
Break it down on a callback or memo, intead a function, this could cause uncontrollable re-renders, since a new function refenrece is create and called on every render.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/component.tsx (1)
55-66:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse action labels for assignment states instead of description strings.
The button state text is wired to
*Desckeys, so users see explanatory sentences rather than the expected action labels (Assign viewers randomly,Assign moderators randomly,Unassign Users).💡 Suggested fix
const intlMessages = defineMessages({ + randomlyAssign: { + id: 'app.createBreakoutRoom.randomlyAssign', + description: 'assign viewers randomly label', + }, randomlyAssignDesc: { id: 'app.createBreakoutRoom.randomlyAssignDesc', description: 'randomly assign label description', }, + assignModeratorsRandomly: { + id: 'app.createBreakoutRoom.assignModeratorsRandomly', + description: 'assign moderators randomly label', + }, assignModeratorsRandomlyDesc: { id: 'app.createBreakoutRoom.assignModeratorsRandomlyDesc', description: 'assign moderators randomly label description', }, + resetAssignments: { + id: 'app.createBreakoutRoom.resetAssignments', + description: 'unassign users label', + }, resetAssignmentsDesc: { id: 'app.createBreakoutRoom.resetAssignmentsDesc', description: 'Reset all user room assignments', }, @@ const assignBtnProps = useMemo(() => { if (assignmentState === 'allAssigned') { return { - label: intl.formatMessage(intlMessages.resetAssignmentsDesc), - tooltip: intl.formatMessage(intlMessages.resetAssignmentsDesc), + label: intl.formatMessage(intlMessages.resetAssignments), + tooltip: intl.formatMessage(intlMessages.resetAssignments), dataTest: 'resetAssignments', }; } if (assignmentState === 'onlyModerators') { return { - label: intl.formatMessage(intlMessages.assignModeratorsRandomlyDesc), - tooltip: intl.formatMessage(intlMessages.assignModeratorsRandomlyDesc), + label: intl.formatMessage(intlMessages.assignModeratorsRandomly), + tooltip: intl.formatMessage(intlMessages.assignModeratorsRandomly), dataTest: 'assignModeratorsRandomly', }; } return { - label: intl.formatMessage(intlMessages.randomlyAssignDesc), - tooltip: intl.formatMessage(intlMessages.randomlyAssignDesc), + label: intl.formatMessage(intlMessages.randomlyAssign), + tooltip: intl.formatMessage(intlMessages.randomlyAssign), dataTest: 'randomlyAssign', }; }, [assignmentState, intl]);Also applies to: 476-495
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/component.tsx` around lines 55 - 66, The button texts are using description keys (randomlyAssignDesc, assignModeratorsRandomlyDesc, resetAssignmentsDesc) which produce sentences; change them to action label keys (e.g., randomlyAssignLabel, assignModeratorsRandomlyLabel, resetAssignmentsLabel) in the translation map and update the component code that renders the buttons to use those label keys instead of the *Desc keys (also apply the same change for the other occurrence around the 476-495 block); ensure the translation IDs and the lookup calls (the symbols randomlyAssignDesc, assignModeratorsRandomlyDesc, resetAssignmentsDesc) are replaced with the new label keys so buttons show concise action text like "Assign viewers randomly", "Assign moderators randomly", and "Unassign Users".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/component.tsx`:
- Around line 55-66: The button texts are using description keys
(randomlyAssignDesc, assignModeratorsRandomlyDesc, resetAssignmentsDesc) which
produce sentences; change them to action label keys (e.g., randomlyAssignLabel,
assignModeratorsRandomlyLabel, resetAssignmentsLabel) in the translation map and
update the component code that renders the buttons to use those label keys
instead of the *Desc keys (also apply the same change for the other occurrence
around the 476-495 block); ensure the translation IDs and the lookup calls (the
symbols randomlyAssignDesc, assignModeratorsRandomlyDesc, resetAssignmentsDesc)
are replaced with the new label keys so buttons show concise action text like
"Assign viewers randomly", "Assign moderators randomly", and "Unassign Users".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2bc92cfe-9991-4db6-a9c6-03d7793dd460
📒 Files selected for processing (4)
bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/room-managment-state/component.tsxbigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/component.tsxbigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/styles.tsbigbluebutton-html5/public/locales/en.json
Tainan404
left a comment
There was a problem hiding this comment.
reviewed and tested the code
|
This pull request has conflicts ☹ |
|
✅ Automated tests have passed! |
b105396
into
bigbluebutton:v4.0.x-develop


What does this PR do?
Implements third state in breakouts randomly assign to randomly assign moderators
Closes Issue(s)
Closes #20402
Motivation
reimplementation of #25021 for 4.0
How to test