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 { for {
breakoutModel <- state.breakout breakoutModel <- state.breakout
roomFrom <- breakoutModel.rooms.get(msg.body.fromBreakoutId)
roomTo <- breakoutModel.rooms.get(msg.body.toBreakoutId)
} yield { } 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 { for {
(redirectToHtml5JoinURL, redirectJoinURL) <- getRedirectUrls(liveMeeting, msg.body.userId, roomTo.externalId, roomTo.sequence.toString()) roomFrom <- breakoutModel.rooms.get(msg.body.fromBreakoutId)
} yield { } yield {
BreakoutHdlrHelpers.sendChangeUserBreakoutMsg( roomFrom.users.filter(u => u.id == msg.body.userId + "-" + roomFrom.sequence).foreach(user => {
outGW, eventBus.publish(BigBlueButtonEvent(roomFrom.id, EjectUserFromBreakoutInternalMsg(meetingId, roomFrom.id, user.id, msg.header.userId, "User moved to another room", EjectReasonCode.EJECT_USER, false)))
meetingId, })
msg.body.userId,
msg.body.fromBreakoutId,
roomTo.id,
redirectToHtml5JoinURL,
)
} }
//Send notification to moved User //Get join URL for room To
val notifyUserEvent = MsgBuilder.buildNotifyUserInMeetingEvtMsg( 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, msg.body.userId,
liveMeeting.props.meetingProp.intId, msg.body.fromBreakoutId,
"info", msg.body.toBreakoutId,
"promote", redirectToHtml5JoinURL,
"app.updateBreakoutRoom.userChangeRoomNotification",
"Notification to warn user was moved to another room",
Vector(roomTo.shortName)
) )
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 state

View File

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

View File

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

View File

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

View File

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