Merge pull request #20673 from Scroody/i-19870

Fix: Breakouts calculation for valid users incorrect
This commit is contained in:
Ramón Souza 2024-07-10 15:11:45 -03:00 committed by GitHub
commit 0c9e11c0e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -265,6 +265,7 @@ class BreakoutRoom extends PureComponent {
captureSlides: false, captureSlides: false,
durationIsValid: true, durationIsValid: true,
breakoutJoinedUsers: null, breakoutJoinedUsers: null,
enableUnassingUsers: null,
}; };
this.btnLevelId = uniqueId('btn-set-level-'); this.btnLevelId = uniqueId('btn-set-level-');
@ -470,7 +471,7 @@ class BreakoutRoom extends PureComponent {
} }
if (users.length === this.getUserByRoom(0).length && !freeJoin) { if (users.length === this.getUserByRoom(0).length && !freeJoin) {
this.setState({ leastOneUserIsValid: false }); this.setState({ leastOneUserIsValid: false, enableUnassingUsers: false });
return; return;
} }
@ -516,6 +517,10 @@ class BreakoutRoom extends PureComponent {
this.setState({ leastOneUserIsValid: false }); this.setState({ leastOneUserIsValid: false });
return; return;
} }
if (users.length === this.getUserByRoom(0).length) {
this.setState({ enableUnassingUsers: false });
return;
}
breakouts.forEach((breakout) => { breakouts.forEach((breakout) => {
const { breakoutId } = breakout; const { breakoutId } = breakout;
@ -637,7 +642,10 @@ class BreakoutRoom extends PureComponent {
} }
setFreeJoin(e) { setFreeJoin(e) {
this.setState({ freeJoin: e.target.checked, leastOneUserIsValid: true }); this.setState({
freeJoin: e.target.checked,
leastOneUserIsValid: true,
});
} }
setRecord(e) { setRecord(e) {
@ -725,6 +733,7 @@ class BreakoutRoom extends PureComponent {
this.setState({ this.setState({
users: usersCopy, users: usersCopy,
leastOneUserIsValid: (this.getUserByRoom(0).length !== users.length || freeJoin), leastOneUserIsValid: (this.getUserByRoom(0).length !== users.length || freeJoin),
enableUnassingUsers: (this.getUserByRoom(0).length !== users.length),
}, () => { }, () => {
addNewAlert(intl.formatMessage(intlMessages.movedUserLabel, { 0: userName, 1: room })) addNewAlert(intl.formatMessage(intlMessages.movedUserLabel, { 0: userName, 1: room }))
}); });
@ -1146,7 +1155,7 @@ class BreakoutRoom extends PureComponent {
if (isUpdate) return null; if (isUpdate) return null;
const { const {
numberOfRoomsIsValid, numberOfRoomsIsValid,
leastOneUserIsValid, enableUnassingUsers,
} = this.state; } = this.state;
return ( return (
@ -1154,7 +1163,7 @@ class BreakoutRoom extends PureComponent {
<Styled.LabelText bold aria-hidden> <Styled.LabelText bold aria-hidden>
{intl.formatMessage(intlMessages.manageRooms)} {intl.formatMessage(intlMessages.manageRooms)}
</Styled.LabelText> </Styled.LabelText>
{leastOneUserIsValid ? ( {enableUnassingUsers ? (
<Styled.AssignBtns <Styled.AssignBtns
data-test="resetAssignments" data-test="resetAssignments"
label={intl.formatMessage(intlMessages.resetAssignments)} label={intl.formatMessage(intlMessages.resetAssignments)}