Missing parts

This commit is contained in:
Gustavo Trott 2022-04-12 13:56:54 -03:00
parent 77a8aba1f5
commit ecbfee26db
5 changed files with 61 additions and 42 deletions

View File

@ -27,39 +27,51 @@ trait ChangeUserBreakoutReqMsgHdlr extends RightsManagementTrait {
for {
breakoutModel <- state.breakout
roomFrom <- breakoutModel.rooms.get(msg.body.fromBreakoutId)
roomTo <- breakoutModel.rooms.get(msg.body.toBreakoutId)
} yield {
//Eject from room From
roomFrom.users.filter(u => u.id == msg.body.userId + "-" + roomFrom.sequence).foreach(user => {
eventBus.publish(BigBlueButtonEvent(roomFrom.id, EjectUserFromBreakoutInternalMsg(meetingId, roomFrom.id, user.id, msg.header.userId, "User moved to another room", EjectReasonCode.EJECT_USER, false)))
})
//Send confirmation msg with invite URL (redirectToHtml5JoinURL)
//Eject user from room From
for {
(redirectToHtml5JoinURL, redirectJoinURL) <- getRedirectUrls(liveMeeting, msg.body.userId, roomTo.externalId, roomTo.sequence.toString())
roomFrom <- breakoutModel.rooms.get(msg.body.fromBreakoutId)
} yield {
BreakoutHdlrHelpers.sendChangeUserBreakoutMsg(
outGW,
meetingId,
msg.body.userId,
msg.body.fromBreakoutId,
roomTo.id,
redirectToHtml5JoinURL,
)
roomFrom.users.filter(u => u.id == msg.body.userId + "-" + roomFrom.sequence).foreach(user => {
eventBus.publish(BigBlueButtonEvent(roomFrom.id, EjectUserFromBreakoutInternalMsg(meetingId, roomFrom.id, user.id, msg.header.userId, "User moved to another room", EjectReasonCode.EJECT_USER, false)))
})
}
//Send notification to moved User
val notifyUserEvent = MsgBuilder.buildNotifyUserInMeetingEvtMsg(
//Get join URL for room To
val redirectToHtml5JoinURL = (
for {
roomTo <- breakoutModel.rooms.get(msg.body.toBreakoutId)
(redirectToHtml5JoinURL, redirectJoinURL) <- getRedirectUrls(liveMeeting, msg.body.userId, roomTo.externalId, roomTo.sequence.toString())
} yield redirectToHtml5JoinURL
).getOrElse("")
BreakoutHdlrHelpers.sendChangeUserBreakoutMsg(
outGW,
meetingId,
msg.body.userId,
liveMeeting.props.meetingProp.intId,
"info",
"promote",
"app.updateBreakoutRoom.userChangeRoomNotification",
"Notification to warn user was moved to another room",
Vector(roomTo.shortName)
msg.body.fromBreakoutId,
msg.body.toBreakoutId,
redirectToHtml5JoinURL,
)
outGW.send(notifyUserEvent)
//Send notification to moved User
for {
roomFrom <- breakoutModel.rooms.get(msg.body.fromBreakoutId)
roomTo <- breakoutModel.rooms.get(msg.body.toBreakoutId)
} yield {
val notifyUserEvent = MsgBuilder.buildNotifyUserInMeetingEvtMsg(
msg.body.userId,
liveMeeting.props.meetingProp.intId,
"info",
"promote",
"app.updateBreakoutRoom.userChangeRoomNotification",
"Notification to warn user was moved to another room",
Vector(roomTo.shortName)
)
outGW.send(notifyUserEvent)
}
}
state

View File

@ -3,8 +3,8 @@ package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs.UserJoinMeetingReqMsg
import org.bigbluebutton.core.apps.breakout.BreakoutHdlrHelpers
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.{Users2x, VoiceUsers}
import org.bigbluebutton.core.running.{HandlerHelpers, LiveMeeting, MeetingActor, OutMsgRouter}
import org.bigbluebutton.core.models.{ Users2x, VoiceUsers }
import org.bigbluebutton.core.running.{ HandlerHelpers, LiveMeeting, MeetingActor, OutMsgRouter }
trait UserJoinMeetingReqMsgHdlr extends HandlerHelpers {
this: MeetingActor =>

View File

@ -45,10 +45,17 @@ export default function userBreakoutChanged({ body }) {
};
try {
const numberAffectedOld = Breakouts.update(oldBreakoutSelector, oldModifier);
const numberAffectedNew = Breakouts.update(newBreakoutSelector, newModifier);
let numberAffectedRows = 0;
if (numberAffectedOld && numberAffectedNew) {
if (oldBreakoutSelector.breakoutId !== '') {
numberAffectedRows += Breakouts.update(oldBreakoutSelector, oldModifier);
}
if (newBreakoutSelector.breakoutId !== '') {
numberAffectedRows += Breakouts.update(newBreakoutSelector, newModifier);
}
if (numberAffectedRows > 0) {
Logger.info(`Updated user breakout for userId=${userId}`);
}
} catch (err) {

View File

@ -137,7 +137,7 @@ Meteor.publish('meeting-time-remaining', timeRemainingPublish);
function notifications() {
const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id });
if (tokenValidation || tokenValidation.validationStatus === ValidationStates.VALIDATED) {
if (tokenValidation && tokenValidation.validationStatus === ValidationStates.VALIDATED) {
notificationEmitter.on('notification', (notification) => {
const { meetingId, userId } = tokenValidation;
switch (notification.type) {

View File

@ -485,7 +485,6 @@ class BreakoutRoom extends PureComponent {
onUpdateBreakouts() {
const { users } = this.state;
const { sendInvitation } = this.props;
const leastOneUserIsValid = users.some((user) => user.from !== user.room);
if (!leastOneUserIsValid) {
@ -496,19 +495,20 @@ class BreakoutRoom extends PureComponent {
const { from, room } = user;
let { userId } = user;
if (from === room || room === 0) return;
if (from === room) return;
const toBreakout = this.getBreakoutBySequence(room);
const { breakoutId: toBreakoutId } = toBreakout;
if (!user.joined) {
sendInvitation(toBreakoutId, userId);
return;
let toBreakoutId = '';
if (room !== 0) {
const toBreakout = this.getBreakoutBySequence(room);
toBreakoutId = toBreakout.breakoutId;
}
[userId] = userId.split('-');
const fromBreakout = this.getBreakoutBySequence(from);
const { breakoutId: fromBreakoutId } = fromBreakout;
let fromBreakoutId = '';
if (from !== 0) {
[userId] = userId.split('-');
const fromBreakout = this.getBreakoutBySequence(from);
fromBreakoutId = fromBreakout.breakoutId;
}
this.changeUserBreakout(fromBreakoutId, toBreakoutId, userId);
});