From 35ddbed8c2b416516108a98fa18bd88aebb4a5f5 Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Tue, 14 Dec 2021 15:45:59 -0300 Subject: [PATCH 001/180] add msg userLeftFlag --- akka-bbb-apps/.bsp/sbt.json | 1 + .../org/bigbluebutton/SystemConfiguration.scala | 2 +- .../apps/users/SelectRandomViewerReqMsgHdlr.scala | 2 +- .../org/bigbluebutton/core/models/Users2x.scala | 7 +++++-- .../core2/message/senders/MsgBuilder.scala | 10 ++++++++++ .../org/bigbluebutton/common2/msgs/UsersMsgs.scala | 14 ++++++++++++++ 6 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 akka-bbb-apps/.bsp/sbt.json diff --git a/akka-bbb-apps/.bsp/sbt.json b/akka-bbb-apps/.bsp/sbt.json new file mode 100644 index 0000000000..6847cb6874 --- /dev/null +++ b/akka-bbb-apps/.bsp/sbt.json @@ -0,0 +1 @@ +{"name":"sbt","version":"1.5.2","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java","-Xms100m","-Xmx100m","-classpath","/home/dev/.local/share/JetBrains/IdeaIC2021.3/Scala/launcher/sbt-launch.jar","xsbt.boot.Boot","-bsp","--sbt-launch-jar=/home/dev/.local/share/JetBrains/IdeaIC2021.3/Scala/launcher/sbt-launch.jar"]} \ No newline at end of file diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala index e6d16fbe4a..34ace5d20a 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala @@ -51,7 +51,7 @@ trait SystemConfiguration { lazy val endMeetingWhenNoMoreAuthedUsersAfterMinutes = Try(config.getInt("apps.endMeetingWhenNoMoreAuthedUsersAfterMinutes")).getOrElse(2) lazy val reduceDuplicatedPick = Try(config.getBoolean("apps.reduceDuplicatedPick")).getOrElse(false) - + // Redis server configuration lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SelectRandomViewerReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SelectRandomViewerReqMsgHdlr.scala index 54b13f5a21..762012dc4c 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SelectRandomViewerReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SelectRandomViewerReqMsgHdlr.scala @@ -50,7 +50,7 @@ trait SelectRandomViewerReqMsgHdlr extends RightsManagementTrait { Users2x.setUserExempted(liveMeeting.users2x, pickedUser, true) } } - + val userIds = users.map { case (v) => v.intId } broadcastEvent(msg, userIds, pickedUser) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala index 13d8922495..9d6e3d64bb 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala @@ -2,6 +2,7 @@ package org.bigbluebutton.core.models import com.softwaremill.quicklens._ import org.bigbluebutton.core.util.TimeUtil +import org.bigbluebutton.core2.message.senders.MsgBuilder object Users2x { def findWithIntId(users: Users2x, intId: String): Option[UserState] = { @@ -33,6 +34,8 @@ object Users2x { } yield { val newUser = u.copy(userLeftFlag = UserLeftFlag(true, System.currentTimeMillis())) users.save(newUser) + val userLeftMeetingEvent = MsgBuilder.buildUserLeftMeetingEvtMsg(, u.intId) + outGW.send(userLeftMeetingEvent) newUser } } @@ -50,7 +53,7 @@ object Users2x { def findAllExpiredUserLeftFlags(users: Users2x, meetingExpireWhenLastUserLeftInMs: Long): Vector[UserState] = { if (meetingExpireWhenLastUserLeftInMs > 0) { users.toVector filter (u => u.userLeftFlag.left && u.userLeftFlag.leftOn != 0 && - System.currentTimeMillis() - u.userLeftFlag.leftOn > 10000) + System.currentTimeMillis() - u.userLeftFlag.leftOn > 30000) } else { // When meetingExpireWhenLastUserLeftInMs is set zero we need to // remove user right away to end the meeting as soon as possible. @@ -164,7 +167,7 @@ object Users2x { newUser } } - + def hasPresenter(users: Users2x): Boolean = { findPresenter(users) match { case Some(p) => true diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala index 4fcf02542d..6f4ee9e751 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala @@ -306,6 +306,16 @@ object MsgBuilder { BbbCommonEnvCoreMsg(envelope, event) } + def buildUserLeftFlagEvtMsg(meetingId: String, userId: String, userLeftFlag: Boolean): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId) + val envelope = BbbCoreEnvelope(UserLeftFlagEvtMsg.NAME, routing) + val header = BbbClientMsgHeader(UserLeftFlagEvtMsg.NAME, meetingId, userId) + val body = UserLeftFlagEvtMsgBody(userId, userLeftFlag) + val event = UserLeftFlagEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + def buildUserInactivityInspectMsg(meetingId: String, userId: String, responseDelay: Long): BbbCommonEnvCoreMsg = { val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId) val envelope = BbbCoreEnvelope(UserInactivityInspectMsg.NAME, routing) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala index 90b2abd1b4..4be0f8d6a1 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala @@ -77,6 +77,20 @@ case class UserLeftMeetingEvtMsg( ) extends BbbCoreMsg case class UserLeftMeetingEvtMsgBody(intId: String) +object UserLeftFlagEvtMsg { + val NAME = "UserLeftFlagEvtMsg" + def apply(meetingId: String, userId: String, body: UserLeftFlagEvtMsgBody): UserLeftFlagEvtMsg = { + val header = BbbClientMsgHeader(UserLeftFlagEvtMsg.NAME, meetingId, userId) + UserLeftFlagEvtMsg(header, body) + } +} + +case class UserLeftFlagEvtMsg( + header: BbbClientMsgHeader, + body: UserLeftFlagEvtMsgBody +) extends BbbCoreMsg +case class UserLeftFlagEvtMsgBody(intId: String, userLeftFlag: Boolean) + object UserJoinedMeetingEvtMsg { val NAME = "UserJoinedMeetingEvtMsg" def apply(meetingId: String, userId: String, body: UserJoinedMeetingEvtMsgBody): UserJoinedMeetingEvtMsg = { From 9c844bdd26be38d19db5fad4ce2edbdb73f4d50a Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Thu, 6 Jan 2022 18:07:22 -0300 Subject: [PATCH 002/180] Add userLeftFlag message --- ...rJoinMeetingAfterReconnectReqMsgHdlr.scala | 9 ++++++- .../users/UserJoinMeetingReqMsgHdlr.scala | 7 ++++++ .../core/apps/users/UserLeaveReqMsgHdlr.scala | 7 ++++++ .../bigbluebutton/core/models/Users2x.scala | 2 -- .../server/modifiers/addUserPersistentData.js | 2 +- .../imports/api/users/server/eventHandlers.js | 2 ++ .../api/users/server/handlers/userLeftFlag.js | 10 ++++++++ .../api/users/server/modifiers/addUser.js | 1 + .../users/server/modifiers/userLeftFlag.js | 24 +++++++++++++++++++ .../imports/api/users/server/publishers.js | 1 + 10 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlag.js create mode 100644 bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlag.js diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala index 88a06ea09e..cd8ec9b5be 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala @@ -6,6 +6,7 @@ import org.bigbluebutton.core.apps.voice.UserJoinedVoiceConfEvtMsgHdlr import org.bigbluebutton.core.domain.MeetingState2x import org.bigbluebutton.core.models.Users2x import org.bigbluebutton.core.running.{ HandlerHelpers, LiveMeeting, MeetingActor, OutMsgRouter } +import org.bigbluebutton.core2.message.senders.MsgBuilder trait UserJoinMeetingAfterReconnectReqMsgHdlr extends HandlerHelpers with UserJoinedVoiceConfEvtMsgHdlr { this: MeetingActor => @@ -15,12 +16,18 @@ trait UserJoinMeetingAfterReconnectReqMsgHdlr extends HandlerHelpers with UserJo def handleUserJoinMeetingAfterReconnectReqMsg(msg: UserJoinMeetingAfterReconnectReqMsg, state: MeetingState2x): MeetingState2x = { log.info("Received user joined after reconnecting. user {} meetingId={}", msg.body.userId, msg.header.meetingId) - Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) match { case Some(reconnectingUser) => if (reconnectingUser.userLeftFlag.left) { log.info("Resetting flag that user left meeting. user {}", msg.body.userId) // User has reconnected. Just reset it's flag. ralam Oct 23, 2018 + println(Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)) + for { + u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) + } yield { + val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, false) + outGW.send(userLeftFlagMeetingEvent) + } Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId) } state diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala index cd8011ff15..e85f341fee 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala @@ -5,6 +5,7 @@ import org.bigbluebutton.core.apps.breakout.BreakoutHdlrHelpers import org.bigbluebutton.core.models.{ Users2x, VoiceUsers } import org.bigbluebutton.core.domain.MeetingState2x import org.bigbluebutton.core.running.{ HandlerHelpers, LiveMeeting, MeetingActor, OutMsgRouter } +import org.bigbluebutton.core2.message.senders.MsgBuilder trait UserJoinMeetingReqMsgHdlr extends HandlerHelpers { this: MeetingActor => @@ -20,6 +21,12 @@ trait UserJoinMeetingReqMsgHdlr extends HandlerHelpers { if (reconnectingUser.userLeftFlag.left) { log.info("Resetting flag that user left meeting. user {}", msg.body.userId) // User has reconnected. Just reset it's flag. ralam Oct 23, 2018 + for { + u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) + } yield { + val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, false) + outGW.send(userLeftFlagMeetingEvent) + } Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId) } state diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala index 6be39e1d9d..829f7310a0 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala @@ -4,6 +4,7 @@ import org.bigbluebutton.common2.msgs.UserLeaveReqMsg import org.bigbluebutton.core.domain.MeetingState2x import org.bigbluebutton.core.models.{ RegisteredUsers, Users2x } import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter } +import org.bigbluebutton.core2.message.senders.MsgBuilder trait UserLeaveReqMsgHdlr { this: MeetingActor => @@ -19,6 +20,12 @@ trait UserLeaveReqMsgHdlr { // Just flag that user has left as the user might be reconnecting. // An audit will remove this user if it hasn't rejoined after a certain period of time. // ralam oct 23, 2018 + for { + u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) + } yield { + val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, true) + outGW.send(userLeftFlagMeetingEvent) + } Users2x.setUserLeftFlag(liveMeeting.users2x, msg.body.userId) } if (msg.body.loggedOut) { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala index 9d6e3d64bb..355e9ae768 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala @@ -34,8 +34,6 @@ object Users2x { } yield { val newUser = u.copy(userLeftFlag = UserLeftFlag(true, System.currentTimeMillis())) users.save(newUser) - val userLeftMeetingEvent = MsgBuilder.buildUserLeftMeetingEvtMsg(, u.intId) - outGW.send(userLeftMeetingEvent) newUser } } diff --git a/bigbluebutton-html5/imports/api/users-persistent-data/server/modifiers/addUserPersistentData.js b/bigbluebutton-html5/imports/api/users-persistent-data/server/modifiers/addUserPersistentData.js index 401ad1d4a0..2cd8fdf6b1 100644 --- a/bigbluebutton-html5/imports/api/users-persistent-data/server/modifiers/addUserPersistentData.js +++ b/bigbluebutton-html5/imports/api/users-persistent-data/server/modifiers/addUserPersistentData.js @@ -25,10 +25,10 @@ export default function addUserPersistentData(user) { locked: Boolean, avatar: String, clientType: String, + left: Boolean, effectiveConnectionType: null, }); - const { intId, extId, diff --git a/bigbluebutton-html5/imports/api/users/server/eventHandlers.js b/bigbluebutton-html5/imports/api/users/server/eventHandlers.js index 6e26902b81..3e189a562f 100644 --- a/bigbluebutton-html5/imports/api/users/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/users/server/eventHandlers.js @@ -1,6 +1,7 @@ import RedisPubSub from '/imports/startup/server/redis'; import handleRemoveUser from './handlers/removeUser'; import handleUserJoined from './handlers/userJoined'; +import handleUserLeftFlag from './handlers/userLeftFlag'; import handleValidateAuthToken from './handlers/validateAuthToken'; import handlePresenterAssigned from './handlers/presenterAssigned'; import handleEmojiStatus from './handlers/emojiStatus'; @@ -15,4 +16,5 @@ RedisPubSub.on('ValidateAuthTokenRespMsg', handleValidateAuthToken); RedisPubSub.on('UserEmojiChangedEvtMsg', handleEmojiStatus); RedisPubSub.on('UserEjectedFromMeetingEvtMsg', handleUserEjected); RedisPubSub.on('UserRoleChangedEvtMsg', handleChangeRole); +RedisPubSub.on('UserLeftFlagEvtMsg', handleUserLeftFlag); RedisPubSub.on('UserInactivityInspectMsg', handleUserInactivityInspect); diff --git a/bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlag.js b/bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlag.js new file mode 100644 index 0000000000..f5f784982f --- /dev/null +++ b/bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlag.js @@ -0,0 +1,10 @@ +import { check } from 'meteor/check'; + +import userLeftFlag from '../modifiers/userLeftFlag'; + +export default function handleUserLeftFlag({ body }, meetingId) { + const user = body; + check(user, Object); + + userLeftFlag(meetingId, user.intId, user.userLeftFlag); +} diff --git a/bigbluebutton-html5/imports/api/users/server/modifiers/addUser.js b/bigbluebutton-html5/imports/api/users/server/modifiers/addUser.js index 9d45538a08..47e35b6881 100755 --- a/bigbluebutton-html5/imports/api/users/server/modifiers/addUser.js +++ b/bigbluebutton-html5/imports/api/users/server/modifiers/addUser.js @@ -61,6 +61,7 @@ export default function addUser(meetingId, userData) { inactivityCheck: false, responseDelay: 0, loggedOut: false, + left: false, ...flat(user), }; diff --git a/bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlag.js b/bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlag.js new file mode 100644 index 0000000000..4cd1b4130d --- /dev/null +++ b/bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlag.js @@ -0,0 +1,24 @@ +import Logger from '/imports/startup/server/logger'; +import Users from '/imports/api/users'; + +export default function userLeftFlag(meetingId, userId, left) { + const selector = { + meetingId, + userId, + }; + + const modifier = { + $set: { + left, + }, + }; + + try { + const numberAffected = Users.update(selector, modifier); + if (numberAffected) { + Logger.info(`Updated user ${userId} with left flag as ${left}`); + } + } catch (err) { + Logger.error(`Changed user role: ${err}`); + } +} diff --git a/bigbluebutton-html5/imports/api/users/server/publishers.js b/bigbluebutton-html5/imports/api/users/server/publishers.js index 1935728a22..ba78a24a9d 100644 --- a/bigbluebutton-html5/imports/api/users/server/publishers.js +++ b/bigbluebutton-html5/imports/api/users/server/publishers.js @@ -59,6 +59,7 @@ function users(role) { { meetingId }, ], intId: { $exists: true }, + left: false, }; const User = Users.findOne({ userId, meetingId }, { fields: { role: 1 } }); From 5ae5d230b8868ec838459376259c2a05b2a45584 Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Fri, 7 Jan 2022 11:37:23 -0300 Subject: [PATCH 003/180] Create util function in HandlerHelper --- akka-bbb-apps/.bsp/sbt.json | 1 - .../org/bigbluebutton/SystemConfiguration.scala | 1 - .../apps/users/SelectRandomViewerReqMsgHdlr.scala | 1 - .../UserJoinMeetingAfterReconnectReqMsgHdlr.scala | 7 +------ .../apps/users/UserJoinMeetingReqMsgHdlr.scala | 8 ++------ .../core/apps/users/UserLeaveReqMsgHdlr.scala | 13 ++++--------- .../org/bigbluebutton/core/models/Users2x.scala | 2 +- .../core/running/HandlerHelpers.scala | 14 ++++++++++++++ .../api/users/server/modifiers/createDummyUser.js | 1 + 9 files changed, 23 insertions(+), 25 deletions(-) delete mode 100644 akka-bbb-apps/.bsp/sbt.json diff --git a/akka-bbb-apps/.bsp/sbt.json b/akka-bbb-apps/.bsp/sbt.json deleted file mode 100644 index 6847cb6874..0000000000 --- a/akka-bbb-apps/.bsp/sbt.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"sbt","version":"1.5.2","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java","-Xms100m","-Xmx100m","-classpath","/home/dev/.local/share/JetBrains/IdeaIC2021.3/Scala/launcher/sbt-launch.jar","xsbt.boot.Boot","-bsp","--sbt-launch-jar=/home/dev/.local/share/JetBrains/IdeaIC2021.3/Scala/launcher/sbt-launch.jar"]} \ No newline at end of file diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala index 34ace5d20a..30353048d9 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala @@ -51,7 +51,6 @@ trait SystemConfiguration { lazy val endMeetingWhenNoMoreAuthedUsersAfterMinutes = Try(config.getInt("apps.endMeetingWhenNoMoreAuthedUsersAfterMinutes")).getOrElse(2) lazy val reduceDuplicatedPick = Try(config.getBoolean("apps.reduceDuplicatedPick")).getOrElse(false) - // Redis server configuration lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SelectRandomViewerReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SelectRandomViewerReqMsgHdlr.scala index 762012dc4c..85858f2dfd 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SelectRandomViewerReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SelectRandomViewerReqMsgHdlr.scala @@ -50,7 +50,6 @@ trait SelectRandomViewerReqMsgHdlr extends RightsManagementTrait { Users2x.setUserExempted(liveMeeting.users2x, pickedUser, true) } } - val userIds = users.map { case (v) => v.intId } broadcastEvent(msg, userIds, pickedUser) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala index cd8ec9b5be..4d32b49abc 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala @@ -22,12 +22,7 @@ trait UserJoinMeetingAfterReconnectReqMsgHdlr extends HandlerHelpers with UserJo log.info("Resetting flag that user left meeting. user {}", msg.body.userId) // User has reconnected. Just reset it's flag. ralam Oct 23, 2018 println(Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)) - for { - u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) - } yield { - val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, false) - outGW.send(userLeftFlagMeetingEvent) - } + sendUserLeftFlagEvtMsg(outGW, liveMeeting, msg.body.userId, false); Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId) } state diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala index e85f341fee..585632f442 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala @@ -21,14 +21,10 @@ trait UserJoinMeetingReqMsgHdlr extends HandlerHelpers { if (reconnectingUser.userLeftFlag.left) { log.info("Resetting flag that user left meeting. user {}", msg.body.userId) // User has reconnected. Just reset it's flag. ralam Oct 23, 2018 - for { - u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) - } yield { - val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, false) - outGW.send(userLeftFlagMeetingEvent) - } + sendUserLeftFlagEvtMsg(outGW, liveMeeting, msg.body.userId, false); Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId) } + state case None => val newState = userJoinMeeting(outGW, msg.body.authToken, msg.body.clientType, liveMeeting, state) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala index 829f7310a0..054afb1be1 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala @@ -3,10 +3,9 @@ package org.bigbluebutton.core.apps.users import org.bigbluebutton.common2.msgs.UserLeaveReqMsg import org.bigbluebutton.core.domain.MeetingState2x import org.bigbluebutton.core.models.{ RegisteredUsers, Users2x } -import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter } -import org.bigbluebutton.core2.message.senders.MsgBuilder +import org.bigbluebutton.core.running.{ HandlerHelpers, MeetingActor, OutMsgRouter } -trait UserLeaveReqMsgHdlr { +trait UserLeaveReqMsgHdlr extends HandlerHelpers { this: MeetingActor => val outGW: OutMsgRouter @@ -20,12 +19,8 @@ trait UserLeaveReqMsgHdlr { // Just flag that user has left as the user might be reconnecting. // An audit will remove this user if it hasn't rejoined after a certain period of time. // ralam oct 23, 2018 - for { - u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) - } yield { - val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, true) - outGW.send(userLeftFlagMeetingEvent) - } + sendUserLeftFlagEvtMsg(outGW, liveMeeting, msg.body.userId, true); + Users2x.setUserLeftFlag(liveMeeting.users2x, msg.body.userId) } if (msg.body.loggedOut) { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala index 355e9ae768..1456349577 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala @@ -51,7 +51,7 @@ object Users2x { def findAllExpiredUserLeftFlags(users: Users2x, meetingExpireWhenLastUserLeftInMs: Long): Vector[UserState] = { if (meetingExpireWhenLastUserLeftInMs > 0) { users.toVector filter (u => u.userLeftFlag.left && u.userLeftFlag.leftOn != 0 && - System.currentTimeMillis() - u.userLeftFlag.leftOn > 30000) + System.currentTimeMillis() - u.userLeftFlag.leftOn > 10000) } else { // When meetingExpireWhenLastUserLeftInMs is set zero we need to // remove user right away to end the meeting as soon as possible. diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala index ea649d84a5..1054d25591 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala @@ -37,6 +37,20 @@ trait HandlerHelpers extends SystemConfiguration { } } + def sendUserLeftFlagEvtMsg( + outGW: OutMsgRouter, + liveMeeting: LiveMeeting, + intId: String, + leftFlag: Boolean + ): Unit = { + for { + u <- Users2x.findWithIntId(liveMeeting.users2x, intId) + } yield { + val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, leftFlag) + outGW.send(userLeftFlagMeetingEvent) + } + } + def userJoinMeeting(outGW: OutMsgRouter, authToken: String, clientType: String, liveMeeting: LiveMeeting, state: MeetingState2x): MeetingState2x = { diff --git a/bigbluebutton-html5/imports/api/users/server/modifiers/createDummyUser.js b/bigbluebutton-html5/imports/api/users/server/modifiers/createDummyUser.js index c8551f0d63..b5390ed728 100644 --- a/bigbluebutton-html5/imports/api/users/server/modifiers/createDummyUser.js +++ b/bigbluebutton-html5/imports/api/users/server/modifiers/createDummyUser.js @@ -19,6 +19,7 @@ export default function createDummyUser(meetingId, userId, authToken) { authToken, clientType: 'HTML5', validated: null, + left: false, }; try { From 7fc8f91a61386125855207c0d538a2b47887a627 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Wed, 9 Feb 2022 10:09:27 -0300 Subject: [PATCH 004/180] Restore audio within main room after leaving breakout room --- .../ui/components/breakout-room/component.jsx | 43 +++++++++++++++++++ .../ui/components/breakout-room/container.jsx | 4 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx index c3c96cc946..cc37b69665 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx @@ -13,6 +13,12 @@ import { PANELS, ACTIONS } from '../layout/enums'; import { screenshareHasEnded } from '/imports/ui/components/screenshare/service'; import UserListService from '/imports/ui/components/user-list/service'; import AudioManager from '/imports/ui/services/audio-manager'; +import Users from '/imports/api/users'; +import Auth from '/imports/ui/services/auth'; +import { + didUserSelectedMicrophone, + didUserSelectedListenOnly +} from '/imports/ui/components/audio/audio-modal/service'; const intlMessages = defineMessages({ breakoutTitle: { @@ -264,6 +270,8 @@ class BreakoutRoom extends PureComponent { intl, isUserInBreakoutRoom, exitAudio, + joinMicrophone, + joinListenOnly, setBreakoutAudioTransferStatus, getBreakoutAudioTransferStatus, } = this.props; @@ -340,6 +348,41 @@ class BreakoutRoom extends PureComponent { VideoService.storeDeviceIds(); VideoService.exitVideo(); if (UserListService.amIPresenter()) screenshareHasEnded(); + + Tracker.autorun((c) => { + const selector = { + meetingId: breakoutId, + }; + + const query = Users.find(selector, { + fields: { + loggedOut: 1, + extId: 1, + }, + }); + + const rejoinAudio = () => { + if (didUserSelectedMicrophone()) { + joinMicrophone(); + } else if (didUserSelectedListenOnly()) { + joinListenOnly(); + } + c.stop(); + } + + query.observe({ + added: (user) => { + if (user?.extId?.startsWith(Auth.userID) && user?.loggedOut) { + rejoinAudio(); + } + }, + changed: (user) => { + if (user?.extId?.startsWith(Auth.userID) && user?.loggedOut) { + rejoinAudio(); + } + } + }) + }) }} disabled={disable} className={styles.joinButton} diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx index f624e063c0..7e01ac6f20 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx @@ -51,7 +51,9 @@ export default withTracker((props) => { amIModerator: amIModerator(), isMeteorConnected, isUserInBreakoutRoom, - exitAudio: () => AudioManager.exitAudio(), + exitAudio: () => AudioManager.forceExitAudio(), + joinMicrophone: () => AudioManager.joinMicrophone(), + joinListenOnly: () => AudioManager.joinListenOnly(), isReconnecting, setBreakoutAudioTransferStatus, getBreakoutAudioTransferStatus, From 507ec568d23cb6b6cf63ff5a07ce89603683c541 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Wed, 9 Feb 2022 11:43:54 -0300 Subject: [PATCH 005/180] Error handling and variable name change --- .../audio/audio-controls/container.jsx | 2 +- .../ui/components/breakout-room/component.jsx | 18 ++++++++++++++---- .../ui/components/breakout-room/container.jsx | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-controls/container.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-controls/container.jsx index 2e6bda4c36..108f1351da 100755 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-controls/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-controls/container.jsx @@ -64,7 +64,7 @@ const handleLeaveAudio = () => { Storage.setItem('getEchoTest', true); } - Service.exitAudio(); + Service.forceExitAudio(); logger.info({ logCode: 'audiocontrols_leave_audio', extraInfo: { logType: 'user_action' }, diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx index cc37b69665..9812aa6041 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx @@ -269,7 +269,7 @@ class BreakoutRoom extends PureComponent { amIModerator, intl, isUserInBreakoutRoom, - exitAudio, + forceExitAudio, joinMicrophone, joinListenOnly, setBreakoutAudioTransferStatus, @@ -340,7 +340,7 @@ class BreakoutRoom extends PureComponent { this.getBreakoutURL(breakoutId); // leave main room's audio, // and stops video and screenshare when joining a breakout room - exitAudio(); + forceExitAudio(); logger.info({ logCode: 'breakoutroom_join', extraInfo: { logType: 'user_action' }, @@ -363,9 +363,19 @@ class BreakoutRoom extends PureComponent { const rejoinAudio = () => { if (didUserSelectedMicrophone()) { - joinMicrophone(); + joinMicrophone().catch(() => { + logger.info({ + logCode: 'mainroom_audio_rejoin', + extraInfo: { logType: 'user_action' }, + }, 'leaving breakout room rejoined audio in the main room'); + }); } else if (didUserSelectedListenOnly()) { - joinListenOnly(); + joinListenOnly().catch(() => { + logger.info({ + logCode: 'mainroom_audio_rejoin', + extraInfo: { logType: 'user_action' }, + }, 'leaving breakout room rejoined audio in the main room'); + }); } c.stop(); } diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx index 7e01ac6f20..e1756d980f 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx @@ -51,7 +51,7 @@ export default withTracker((props) => { amIModerator: amIModerator(), isMeteorConnected, isUserInBreakoutRoom, - exitAudio: () => AudioManager.forceExitAudio(), + forceExitAudio: () => AudioManager.forceExitAudio(), joinMicrophone: () => AudioManager.joinMicrophone(), joinListenOnly: () => AudioManager.joinListenOnly(), isReconnecting, From 9db73b8aac0fae6925c9d8589a5177b9eaa8675b Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Wed, 9 Feb 2022 14:03:35 -0300 Subject: [PATCH 006/180] Fix error log and add some linting --- .../ui/components/breakout-room/component.jsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx index 9812aa6041..7a36ed8603 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx @@ -17,7 +17,7 @@ import Users from '/imports/api/users'; import Auth from '/imports/ui/services/auth'; import { didUserSelectedMicrophone, - didUserSelectedListenOnly + didUserSelectedListenOnly, } from '/imports/ui/components/audio/audio-modal/service'; const intlMessages = defineMessages({ @@ -364,17 +364,17 @@ class BreakoutRoom extends PureComponent { const rejoinAudio = () => { if (didUserSelectedMicrophone()) { joinMicrophone().catch(() => { - logger.info({ + logger.warn({ logCode: 'mainroom_audio_rejoin', extraInfo: { logType: 'user_action' }, - }, 'leaving breakout room rejoined audio in the main room'); + }, 'leaving breakout room couldn\'t rejoin audio in the main room'); }); } else if (didUserSelectedListenOnly()) { joinListenOnly().catch(() => { - logger.info({ + logger.warn({ logCode: 'mainroom_audio_rejoin', extraInfo: { logType: 'user_action' }, - }, 'leaving breakout room rejoined audio in the main room'); + }, 'leaving breakout room couldn\'t rejoin audio in the main room'); }); } c.stop(); @@ -382,17 +382,17 @@ class BreakoutRoom extends PureComponent { query.observe({ added: (user) => { - if (user?.extId?.startsWith(Auth.userID) && user?.loggedOut) { + if (user?.loggedOut && user?.extId?.startsWith(Auth.userID)) { rejoinAudio(); } }, changed: (user) => { - if (user?.extId?.startsWith(Auth.userID) && user?.loggedOut) { + if (user?.loggedOut && user?.extId?.startsWith(Auth.userID)) { rejoinAudio(); } - } - }) - }) + }, + }); + }); }} disabled={disable} className={styles.joinButton} From 5128a773a7e72487d4e27ee5248815d5f8523dc8 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Thu, 10 Feb 2022 09:30:43 -0300 Subject: [PATCH 007/180] Mute user after rejoining audio --- .../ui/components/breakout-room/component.jsx | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx index 7a36ed8603..37aa861d34 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx @@ -15,6 +15,7 @@ import UserListService from '/imports/ui/components/user-list/service'; import AudioManager from '/imports/ui/services/audio-manager'; import Users from '/imports/api/users'; import Auth from '/imports/ui/services/auth'; +import { makeCall } from '/imports/ui/services/api'; import { didUserSelectedMicrophone, didUserSelectedListenOnly, @@ -361,24 +362,30 @@ class BreakoutRoom extends PureComponent { }, }); + const logMessage = () => { + logger.warn({ + logCode: 'mainroom_audio_rejoin', + extraInfo: { logType: 'user_action' }, + }, 'leaving breakout room couldn\'t rejoin audio in the main room'); + }; + const rejoinAudio = () => { if (didUserSelectedMicrophone()) { - joinMicrophone().catch(() => { - logger.warn({ - logCode: 'mainroom_audio_rejoin', - extraInfo: { logType: 'user_action' }, - }, 'leaving breakout room couldn\'t rejoin audio in the main room'); + joinMicrophone().then(() => { + makeCall('toggleVoice', null, true).catch(() => { + forceExitAudio(); + logMessage(); + }); + }).catch(() => { + logMessage(); }); } else if (didUserSelectedListenOnly()) { joinListenOnly().catch(() => { - logger.warn({ - logCode: 'mainroom_audio_rejoin', - extraInfo: { logType: 'user_action' }, - }, 'leaving breakout room couldn\'t rejoin audio in the main room'); + logMessage(); }); } c.stop(); - } + }; query.observe({ added: (user) => { From 3e7a44033bc2743abda867a643b39d264ec0adea Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 11 Feb 2022 13:27:34 -0300 Subject: [PATCH 008/180] Move out rejoinAudio function to container --- .../ui/components/breakout-room/component.jsx | 35 ++----------------- .../ui/components/breakout-room/container.jsx | 31 ++++++++++++++-- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx index 37aa861d34..f6df8e2f28 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx @@ -15,11 +15,6 @@ import UserListService from '/imports/ui/components/user-list/service'; import AudioManager from '/imports/ui/services/audio-manager'; import Users from '/imports/api/users'; import Auth from '/imports/ui/services/auth'; -import { makeCall } from '/imports/ui/services/api'; -import { - didUserSelectedMicrophone, - didUserSelectedListenOnly, -} from '/imports/ui/components/audio/audio-modal/service'; const intlMessages = defineMessages({ breakoutTitle: { @@ -271,8 +266,7 @@ class BreakoutRoom extends PureComponent { intl, isUserInBreakoutRoom, forceExitAudio, - joinMicrophone, - joinListenOnly, + rejoinAudio, setBreakoutAudioTransferStatus, getBreakoutAudioTransferStatus, } = this.props; @@ -362,40 +356,17 @@ class BreakoutRoom extends PureComponent { }, }); - const logMessage = () => { - logger.warn({ - logCode: 'mainroom_audio_rejoin', - extraInfo: { logType: 'user_action' }, - }, 'leaving breakout room couldn\'t rejoin audio in the main room'); - }; - - const rejoinAudio = () => { - if (didUserSelectedMicrophone()) { - joinMicrophone().then(() => { - makeCall('toggleVoice', null, true).catch(() => { - forceExitAudio(); - logMessage(); - }); - }).catch(() => { - logMessage(); - }); - } else if (didUserSelectedListenOnly()) { - joinListenOnly().catch(() => { - logMessage(); - }); - } - c.stop(); - }; - query.observe({ added: (user) => { if (user?.loggedOut && user?.extId?.startsWith(Auth.userID)) { rejoinAudio(); + c.stop(); } }, changed: (user) => { if (user?.loggedOut && user?.extId?.startsWith(Auth.userID)) { rejoinAudio(); + c.stop(); } }, }); diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx index e1756d980f..8658e3190b 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx @@ -5,6 +5,10 @@ import AudioManager from '/imports/ui/services/audio-manager'; import BreakoutComponent from './component'; import Service from './service'; import LayoutContext from '../layout/context'; +import { + didUserSelectedMicrophone, + didUserSelectedListenOnly, +} from '/imports/ui/components/audio/audio-modal/service'; const BreakoutContainer = (props) => { const layoutContext = useContext(LayoutContext); @@ -36,6 +40,30 @@ export default withTracker((props) => { getBreakoutAudioTransferStatus, } = AudioService; + const logMessage = () => { + logger.warn({ + logCode: 'mainroom_audio_rejoin', + extraInfo: { logType: 'user_action' }, + }, 'leaving breakout room couldn\'t rejoin audio in the main room'); + }; + + const rejoinAudio = () => { + if (didUserSelectedMicrophone()) { + AudioManager.joinMicrophone().then(() => { + makeCall('toggleVoice', null, true).catch(() => { + forceExitAudio(); + logMessage(); + }); + }).catch(() => { + logMessage(); + }); + } else if (didUserSelectedListenOnly()) { + AudioManager.joinListenOnly().catch(() => { + logMessage(); + }); + } + }; + return { ...props, breakoutRooms, @@ -52,8 +80,7 @@ export default withTracker((props) => { isMeteorConnected, isUserInBreakoutRoom, forceExitAudio: () => AudioManager.forceExitAudio(), - joinMicrophone: () => AudioManager.joinMicrophone(), - joinListenOnly: () => AudioManager.joinListenOnly(), + rejoinAudio, isReconnecting, setBreakoutAudioTransferStatus, getBreakoutAudioTransferStatus, From 88930d67764ff22632a227a6df81f3e7ffa8780a Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 11 Feb 2022 13:32:02 -0300 Subject: [PATCH 009/180] Rename function for logging --- .../imports/ui/components/breakout-room/container.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx index 8658e3190b..1c118f5af7 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx @@ -40,7 +40,7 @@ export default withTracker((props) => { getBreakoutAudioTransferStatus, } = AudioService; - const logMessage = () => { + const logUserCouldNotRejoinAudio = () => { logger.warn({ logCode: 'mainroom_audio_rejoin', extraInfo: { logType: 'user_action' }, @@ -52,14 +52,14 @@ export default withTracker((props) => { AudioManager.joinMicrophone().then(() => { makeCall('toggleVoice', null, true).catch(() => { forceExitAudio(); - logMessage(); + logUserCouldNotRejoinAudio(); }); }).catch(() => { - logMessage(); + logUserCouldNotRejoinAudio(); }); } else if (didUserSelectedListenOnly()) { AudioManager.joinListenOnly().catch(() => { - logMessage(); + logUserCouldNotRejoinAudio(); }); } }; From 45a873876f837bde24d122f16fea29b784377033 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 11 Feb 2022 13:37:22 -0300 Subject: [PATCH 010/180] Add import and fix function call --- .../imports/ui/components/breakout-room/container.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx index 1c118f5af7..79e64eece3 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/container.jsx @@ -9,6 +9,7 @@ import { didUserSelectedMicrophone, didUserSelectedListenOnly, } from '/imports/ui/components/audio/audio-modal/service'; +import { makeCall } from '/imports/ui/services/api'; const BreakoutContainer = (props) => { const layoutContext = useContext(LayoutContext); @@ -51,7 +52,7 @@ export default withTracker((props) => { if (didUserSelectedMicrophone()) { AudioManager.joinMicrophone().then(() => { makeCall('toggleVoice', null, true).catch(() => { - forceExitAudio(); + AudioManager.forceExitAudio(); logUserCouldNotRejoinAudio(); }); }).catch(() => { From e9cd895c298d92d97212d79354d68a237abf41f2 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 11 Feb 2022 13:45:55 -0300 Subject: [PATCH 011/180] Fix duplicated function --- .../ui/components/breakout-room/component.jsx | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx index f6df8e2f28..4098a11821 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx @@ -356,19 +356,16 @@ class BreakoutRoom extends PureComponent { }, }); + const observeLogOut = (user) => { + if (user?.loggedOut && user?.extId?.startsWith(Auth.userID)) { + rejoinAudio(); + c.stop(); + } + } + query.observe({ - added: (user) => { - if (user?.loggedOut && user?.extId?.startsWith(Auth.userID)) { - rejoinAudio(); - c.stop(); - } - }, - changed: (user) => { - if (user?.loggedOut && user?.extId?.startsWith(Auth.userID)) { - rejoinAudio(); - c.stop(); - } - }, + added: observeLogOut, + changed: observeLogOut, }); }); }} From 68346a8ac9bab53c4b25dccada1fddf11b9d064d Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Wed, 16 Feb 2022 15:46:02 -0300 Subject: [PATCH 012/180] Rename the message to userLeftFlagUpdated --- ...UserJoinMeetingAfterReconnectReqMsgHdlr.scala | 2 +- .../apps/users/UserJoinMeetingReqMsgHdlr.scala | 2 +- .../core/apps/users/UserLeaveReqMsgHdlr.scala | 2 +- .../core/running/HandlerHelpers.scala | 4 ++-- .../core2/message/senders/MsgBuilder.scala | 10 +++++----- .../bigbluebutton/common2/msgs/UsersMsgs.scala | 16 ++++++++-------- .../imports/api/users/server/eventHandlers.js | 4 ++-- .../{userLeftFlag.js => userLeftFlagUpdated.js} | 2 +- .../{userLeftFlag.js => userLeftFlagUpdated.js} | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) rename bigbluebutton-html5/imports/api/users/server/handlers/{userLeftFlag.js => userLeftFlagUpdated.js} (77%) rename bigbluebutton-html5/imports/api/users/server/modifiers/{userLeftFlag.js => userLeftFlagUpdated.js} (86%) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala index 4d32b49abc..670d3907d4 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingAfterReconnectReqMsgHdlr.scala @@ -22,7 +22,7 @@ trait UserJoinMeetingAfterReconnectReqMsgHdlr extends HandlerHelpers with UserJo log.info("Resetting flag that user left meeting. user {}", msg.body.userId) // User has reconnected. Just reset it's flag. ralam Oct 23, 2018 println(Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)) - sendUserLeftFlagEvtMsg(outGW, liveMeeting, msg.body.userId, false); + sendUserLeftFlagUpdatedEvtMsg(outGW, liveMeeting, msg.body.userId, false); Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId) } state diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala index 585632f442..790bccb72f 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala @@ -21,7 +21,7 @@ trait UserJoinMeetingReqMsgHdlr extends HandlerHelpers { if (reconnectingUser.userLeftFlag.left) { log.info("Resetting flag that user left meeting. user {}", msg.body.userId) // User has reconnected. Just reset it's flag. ralam Oct 23, 2018 - sendUserLeftFlagEvtMsg(outGW, liveMeeting, msg.body.userId, false); + sendUserLeftFlagUpdatedEvtMsg(outGW, liveMeeting, msg.body.userId, false); Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala index 054afb1be1..9da0080f5c 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserLeaveReqMsgHdlr.scala @@ -19,7 +19,7 @@ trait UserLeaveReqMsgHdlr extends HandlerHelpers { // Just flag that user has left as the user might be reconnecting. // An audit will remove this user if it hasn't rejoined after a certain period of time. // ralam oct 23, 2018 - sendUserLeftFlagEvtMsg(outGW, liveMeeting, msg.body.userId, true); + sendUserLeftFlagUpdatedEvtMsg(outGW, liveMeeting, msg.body.userId, true); Users2x.setUserLeftFlag(liveMeeting.users2x, msg.body.userId) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala index af320f7937..f2ed221aaa 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala @@ -38,7 +38,7 @@ trait HandlerHelpers extends SystemConfiguration { } } - def sendUserLeftFlagEvtMsg( + def sendUserLeftFlagUpdatedEvtMsg( outGW: OutMsgRouter, liveMeeting: LiveMeeting, intId: String, @@ -47,7 +47,7 @@ trait HandlerHelpers extends SystemConfiguration { for { u <- Users2x.findWithIntId(liveMeeting.users2x, intId) } yield { - val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, leftFlag) + val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagUpdatedEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, leftFlag) outGW.send(userLeftFlagMeetingEvent) } } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala index c4ce2054ec..a67f205e62 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala @@ -309,12 +309,12 @@ object MsgBuilder { BbbCommonEnvCoreMsg(envelope, event) } - def buildUserLeftFlagEvtMsg(meetingId: String, userId: String, userLeftFlag: Boolean): BbbCommonEnvCoreMsg = { + def buildUserLeftFlagUpdatedEvtMsg(meetingId: String, userId: String, userLeftFlag: Boolean): BbbCommonEnvCoreMsg = { val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId) - val envelope = BbbCoreEnvelope(UserLeftFlagEvtMsg.NAME, routing) - val header = BbbClientMsgHeader(UserLeftFlagEvtMsg.NAME, meetingId, userId) - val body = UserLeftFlagEvtMsgBody(userId, userLeftFlag) - val event = UserLeftFlagEvtMsg(header, body) + val envelope = BbbCoreEnvelope(UserLeftFlagUpdatedEvtMsg.NAME, routing) + val header = BbbClientMsgHeader(UserLeftFlagUpdatedEvtMsg.NAME, meetingId, userId) + val body = UserLeftFlagUpdatedEvtMsgBody(userId, userLeftFlag) + val event = UserLeftFlagUpdatedEvtMsg(header, body) BbbCommonEnvCoreMsg(envelope, event) } diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala index 1209ec94fb..be583273f7 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala @@ -77,19 +77,19 @@ case class UserLeftMeetingEvtMsg( ) extends BbbCoreMsg case class UserLeftMeetingEvtMsgBody(intId: String) -object UserLeftFlagEvtMsg { - val NAME = "UserLeftFlagEvtMsg" - def apply(meetingId: String, userId: String, body: UserLeftFlagEvtMsgBody): UserLeftFlagEvtMsg = { - val header = BbbClientMsgHeader(UserLeftFlagEvtMsg.NAME, meetingId, userId) - UserLeftFlagEvtMsg(header, body) +object UserLeftFlagUpdatedEvtMsg { + val NAME = "UserLeftFlagUpdatedEvtMsg" + def apply(meetingId: String, userId: String, body: UserLeftFlagUpdatedEvtMsgBody): UserLeftFlagUpdatedEvtMsg = { + val header = BbbClientMsgHeader(UserLeftFlagUpdatedEvtMsg.NAME, meetingId, userId) + UserLeftFlagUpdatedEvtMsg(header, body) } } -case class UserLeftFlagEvtMsg( +case class UserLeftFlagUpdatedEvtMsg( header: BbbClientMsgHeader, - body: UserLeftFlagEvtMsgBody + body: UserLeftFlagUpdatedEvtMsgBody ) extends BbbCoreMsg -case class UserLeftFlagEvtMsgBody(intId: String, userLeftFlag: Boolean) +case class UserLeftFlagUpdatedEvtMsgBody(intId: String, userLeftFlag: Boolean) object UserJoinedMeetingEvtMsg { val NAME = "UserJoinedMeetingEvtMsg" diff --git a/bigbluebutton-html5/imports/api/users/server/eventHandlers.js b/bigbluebutton-html5/imports/api/users/server/eventHandlers.js index df0298c4c0..4ee8f23acc 100644 --- a/bigbluebutton-html5/imports/api/users/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/users/server/eventHandlers.js @@ -1,7 +1,7 @@ import RedisPubSub from '/imports/startup/server/redis'; import handleRemoveUser from './handlers/removeUser'; import handleUserJoined from './handlers/userJoined'; -import handleUserLeftFlag from './handlers/userLeftFlag'; +import handleUserLeftFlagUpdated from './handlers/userLeftFlagUpdated'; import handleValidateAuthToken from './handlers/validateAuthToken'; import handlePresenterAssigned from './handlers/presenterAssigned'; import handleEmojiStatus from './handlers/emojiStatus'; @@ -17,6 +17,6 @@ RedisPubSub.on('ValidateAuthTokenRespMsg', handleValidateAuthToken); RedisPubSub.on('UserEmojiChangedEvtMsg', handleEmojiStatus); RedisPubSub.on('UserEjectedFromMeetingEvtMsg', handleUserEjected); RedisPubSub.on('UserRoleChangedEvtMsg', handleChangeRole); -RedisPubSub.on('UserLeftFlagEvtMsg', handleUserLeftFlag); +RedisPubSub.on('UserLeftFlagUpdatedEvtMsg', handleUserLeftFlagUpdated); RedisPubSub.on('UserPinStateChangedEvtMsg', handleUserPinChanged); RedisPubSub.on('UserInactivityInspectMsg', handleUserInactivityInspect); diff --git a/bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlag.js b/bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlagUpdated.js similarity index 77% rename from bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlag.js rename to bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlagUpdated.js index f5f784982f..17abfb89af 100644 --- a/bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlag.js +++ b/bigbluebutton-html5/imports/api/users/server/handlers/userLeftFlagUpdated.js @@ -1,6 +1,6 @@ import { check } from 'meteor/check'; -import userLeftFlag from '../modifiers/userLeftFlag'; +import userLeftFlag from '../modifiers/userLeftFlagUpdated'; export default function handleUserLeftFlag({ body }, meetingId) { const user = body; diff --git a/bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlag.js b/bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlagUpdated.js similarity index 86% rename from bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlag.js rename to bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlagUpdated.js index 4cd1b4130d..ae157ec9bb 100644 --- a/bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlag.js +++ b/bigbluebutton-html5/imports/api/users/server/modifiers/userLeftFlagUpdated.js @@ -1,7 +1,7 @@ import Logger from '/imports/startup/server/logger'; import Users from '/imports/api/users'; -export default function userLeftFlag(meetingId, userId, left) { +export default function userLeftFlagUpdated(meetingId, userId, left) { const selector = { meetingId, userId, From e798d31df28deaa7ee89340cf25353447a331362 Mon Sep 17 00:00:00 2001 From: Guilherme Leme Date: Fri, 4 Mar 2022 16:40:59 -0300 Subject: [PATCH 013/180] [issue-14321] - Fixed the sudden change of presentations when clicking on the confirm button. --- .../presentation/presentation-uploader/component.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx index 1d5242feff..535704a21c 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx @@ -300,8 +300,8 @@ class PresentationUploader extends Component { this.setState({ presentations: Object.values({ - ...propPresentations, ...presentations, + ...propPresentations, }), }); } @@ -548,8 +548,8 @@ class PresentationUploader extends Component { const { presentations: propPresentations } = this.props; const ids = new Set(propPresentations.map((d) => d.ID)); const merged = [ - ...propPresentations, ...presentations.filter((d) => !ids.has(d.ID)), + ...propPresentations, ]; this.setState( { presentations: merged }, From ab869b42217559aeada60a55c2ef116f7c27b3e7 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Wed, 9 Mar 2022 16:08:56 -0300 Subject: [PATCH 014/180] Prevent redirect after feedback of user --- .../ui/components/meeting-ended/component.jsx | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx b/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx index bce1e038ba..141b4cd666 100755 --- a/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx @@ -174,14 +174,8 @@ class MeetingEnded extends PureComponent { } confirmRedirect() { - const { - selected, - } = this.state; - - if (selected <= 0) { - if (meetingIsBreakout()) window.close(); - if (allowRedirectToLogoutURL()) logoutRouteHandler(); - } + if (meetingIsBreakout()) window.close(); + if (allowRedirectToLogoutURL()) logoutRouteHandler(); } getEndingMessage() { @@ -236,18 +230,9 @@ class MeetingEnded extends PureComponent { dispatched: true, }); - if (allowRedirectToLogoutURL()) { - const FEEDBACK_WAIT_TIME = 500; - setTimeout(() => { - fetch(url, options) - .then(() => { - logoutRouteHandler(); - }) - .catch(() => { - logoutRouteHandler(); - }); - }, FEEDBACK_WAIT_TIME); - } + fetch(url, options).catch((e) => { + logger.warn(e); + }); } renderNoFeedback() { @@ -309,7 +294,6 @@ class MeetingEnded extends PureComponent { const { intl, code, ejectedReason } = this.props; const { selected, - dispatched, } = this.state; const noRating = selected <= 0; @@ -347,17 +331,17 @@ class MeetingEnded extends PureComponent { ) : null} ) : null} - {noRating && allowRedirectToLogoutURL() ? ( + {noRating ? (