From b3f1d51f44b64f6c04428782ea77396d4c67a328 Mon Sep 17 00:00:00 2001 From: Gustavo Trott Date: Wed, 26 May 2021 17:16:15 -0300 Subject: [PATCH] Updates user lastActivityTime in parent room while user is in breakout room --- .../apps/breakout/BreakoutRoomUsersUpdateMsgHdlr.scala | 8 ++++++++ .../scala/org/bigbluebutton/core/models/Users2x.scala | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomUsersUpdateMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomUsersUpdateMsgHdlr.scala index 8d4825e49a..1dbfa28c0e 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomUsersUpdateMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomUsersUpdateMsgHdlr.scala @@ -3,6 +3,7 @@ package org.bigbluebutton.core.apps.breakout import org.bigbluebutton.common2.msgs._ import org.bigbluebutton.core.api.BreakoutRoomUsersUpdateInternalMsg import org.bigbluebutton.core.domain.{ BreakoutRoom2x, MeetingState2x } +import org.bigbluebutton.core.models.Users2x import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter } trait BreakoutRoomUsersUpdateMsgHdlr { @@ -30,6 +31,13 @@ trait BreakoutRoomUsersUpdateMsgHdlr { val updatedRoom = room.copy(users = msg.users, voiceUsers = msg.voiceUsers) val msgEvent = broadcastEvent(updatedRoom) outGW.send(msgEvent) + + //Update user lastActivityTime in parent room (to avoid be ejected while is in Breakout room) + for { + breakoutRoomUser <- updatedRoom.users + user <- Users2x.findWithBreakoutRoomId(liveMeeting.users2x, breakoutRoomUser.id) + } yield Users2x.updateLastUserActivity(liveMeeting.users2x, user) + model.update(updatedRoom) } 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 79cae79e00..242f6c650d 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 @@ -8,6 +8,14 @@ object Users2x { users.toVector find (u => u.intId == intId) } + def findWithBreakoutRoomId(users: Users2x, breakoutRoomId: String): Option[UserState] = { + //userId + "-" + roomSequence + val userIdParts = breakoutRoomId.split("-") + val userExtId = userIdParts(0) + + users.toVector find (u => u.extId == userExtId) + } + def findAll(users: Users2x): Vector[UserState] = users.toVector def add(users: Users2x, user: UserState): Option[UserState] = {