Skip to content

feat(client): Include moderators when randomly assigning users to breakout rooms if all remaining users are moderators - #25120

Merged
antobinary merged 6 commits into
bigbluebutton:v4.0.x-developfrom
ramonlsouza:p25021
Jul 22, 2026
Merged

antobinary merged 6 commits into
bigbluebutton:v4.0.x-developfrom
ramonlsouza:p25021

Conversation

@ramonlsouza

Copy link
Copy Markdown
Member

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

  1. join a meeting with a moderator and a viewer
  2. open create breakout rooms
  3. click the "Assign viewers randomly" button
  4. it should randomly move the viewer to a room and the button tooltip should change to "Assign moderators randomly"
  5. click the "Assign moderators randomly" button
  6. it should randomly move the moderator to a room and the button tooltip should change to "Unassign Users"

@coderabbitai

coderabbitai Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7a90f8b9-49d3-4fbb-b73e-3ed214f11dbc

📥 Commits

Reviewing files that changed from the base of the PR and between beac715 and a79e16b.

📒 Files selected for processing (2)
  • bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/component.tsx
  • bigbluebutton-html5/public/locales/en.json
💤 Files with no reviewable changes (1)
  • bigbluebutton-html5/public/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/component.tsx

Walkthrough

This pull request updates breakout room random assignment to distinguish between unassigned viewers, unassigned moderators, and fully assigned rooms. RoomManagmentState now exposes moderator-specific assignment and assignment-state callbacks. SidebarCreateBreakout uses the emitted state to switch button labels, tooltips, icons, and click behavior. Localization strings were updated to refer to viewers and moderators separately.

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • GuiLeme
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main behavior change: including moderators in random breakout-room assignment.
Description check ✅ Passed The description matches the code changes and explains the new third-state assignment flow.
Linked Issues check ✅ Passed The PR implements the requested third-state button behavior and includes moderators when only moderators remain [#20402].
Out of Scope Changes check ✅ Passed The changed files all support the breakout-room assignment flow and localization, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@antobinary antobinary added this to the Release 4.0 milestone May 21, 2026

Copilot AI 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.

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 randomlyAssigned boolean with a 3-state assignmentState driving the assign/unassign button behavior in the sidebar UI.
  • Implements randomlyAssignModerators in RoomManagmentState and 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');

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 hardcoded hasViewers, will not cause on a mod only meeting. start the button with a initial wrong state?

/>
{(() => {
let assignBtnLabel: string;
let assignBtnTooltip: string;

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.

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.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
16.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@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.

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 win

Use action labels for assignment states instead of description strings.

The button state text is wired to *Desc keys, 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

📥 Commits

Reviewing files that changed from the base of the PR and between d12365d and beac715.

📒 Files selected for processing (4)
  • bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/room-managment-state/component.tsx
  • bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/component.tsx
  • bigbluebutton-html5/imports/ui/components/breakout-room/create-breakout-room/sidebar-create-breakout/styles.ts
  • bigbluebutton-html5/public/locales/en.json

@ramonlsouza
ramonlsouza requested a review from Tainan404 May 28, 2026 11:04

@Tainan404 Tainan404 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.

reviewed and tested the code

@antobinary antobinary changed the title Include moderators when randomly assigning users to breakout rooms if all remaining users are moderators feat(client): Include moderators when randomly assigning users to breakout rooms if all remaining users are moderators May 28, 2026
@antobinary
antobinary requested a review from lfzawacki May 28, 2026 18:07
@github-actions

Copy link
Copy Markdown

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@sonarqubecloud

sonarqubecloud Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
16.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@antobinary
antobinary merged commit b105396 into bigbluebutton:v4.0.x-develop Jul 22, 2026
35 of 36 checks passed
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.

5 participants