Change registeredUser joined to false after leave

This commit is contained in:
Paul Trudel 2023-04-26 15:41:29 +00:00
parent 8b10ff9d2c
commit 1b5015211e
5 changed files with 12 additions and 4 deletions

View File

@ -27,6 +27,11 @@ trait ValidateAuthTokenReqMsgHdlr extends HandlerHelpers {
case Some(u) =>
// Check if maxParticipants has been reached
// User are able to reenter if he already joined previously with the same extId
log.info("===== MaxParticipants Check =====")
log.info("Max users: [{}]", liveMeeting.props.usersProp.maxUsers)
log.info("Number of unique joined users: [{}]", RegisteredUsers.numUniqueJoinedUsers(liveMeeting.registeredUsers))
log.info("Is the user rejoining with the same external ID? [{}]", RegisteredUsers.checkUserExtIdHasJoined(u.externId, liveMeeting.registeredUsers))
log.info("=================================")
val hasReachedMaxParticipants = liveMeeting.props.usersProp.maxUsers > 0 &&
RegisteredUsers.numUniqueJoinedUsers(liveMeeting.registeredUsers) >= liveMeeting.props.usersProp.maxUsers &&
RegisteredUsers.checkUserExtIdHasJoined(u.externId, liveMeeting.registeredUsers) == false

View File

@ -146,8 +146,8 @@ object RegisteredUsers {
u
}
def updateUserJoin(users: RegisteredUsers, user: RegisteredUser): RegisteredUser = {
val u = user.copy(joined = true)
def updateUserJoin(users: RegisteredUsers, user: RegisteredUser, joined: Boolean): RegisteredUser = {
val u = user.copy(joined = joined)
users.save(u)
u
}

View File

@ -21,7 +21,7 @@ trait HandlerHelpers extends SystemConfiguration {
regUser: RegisteredUser
): Unit = {
if (!regUser.joined) {
RegisteredUsers.updateUserJoin(liveMeeting.registeredUsers, regUser)
RegisteredUsers.updateUserJoin(liveMeeting.registeredUsers, regUser, joined = true)
}
}

View File

@ -869,9 +869,12 @@ class MeetingActor(
leftUsers foreach { leftUser =>
for {
u <- Users2x.remove(liveMeeting.users2x, leftUser.intId)
ru <- RegisteredUsers.findWithUserId(leftUser.intId, liveMeeting.registeredUsers)
} yield {
log.info("Removing user from meeting. meetingId=" + props.meetingProp.intId + " userId=" + u.intId + " user=" + u)
RegisteredUsers.updateUserJoin(liveMeeting.registeredUsers, ru, joined = false)
captionApp2x.handleUserLeavingMsg(leftUser.intId, liveMeeting, msgBus)
// send a user left event for the clients to update

View File

@ -202,7 +202,7 @@ public class Meeting {
}
public Integer countUniqueExtIds() {
List<String> uniqueExtIds = new ArrayList<String>();
List<String> uniqueExtIds = new ArrayList<>();
for (User user : users.values()) {
if(!uniqueExtIds.contains(user.getExternalUserId())) {
uniqueExtIds.add(user.getExternalUserId());