Merge pull request #14447 from gustavotrott/fix-dashboard-user-demote

fix: Dashboard doesn't update user demote
This commit is contained in:
Anton Georgiev 2022-02-23 16:59:39 -05:00 committed by GitHub
commit fb711e7748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -270,16 +270,14 @@ class LearningDashboardActor(
}
private def handleUserRoleChangedEvtMsg(msg: UserRoleChangedEvtMsg) {
if(msg.body.role == Roles.MODERATOR_ROLE) {
for {
meeting <- meetings.values.find(m => m.intId == msg.header.meetingId)
user <- findUserByIntId(meeting, msg.body.userId)
} yield {
val updatedUser = user.copy(isModerator = true)
val updatedMeeting = meeting.copy(users = meeting.users + (updatedUser.userKey -> updatedUser))
for {
meeting <- meetings.values.find(m => m.intId == msg.header.meetingId)
user <- findUserByIntId(meeting, msg.body.userId)
} yield {
val updatedUser = user.copy(isModerator = (msg.body.role == Roles.MODERATOR_ROLE))
val updatedMeeting = meeting.copy(users = meeting.users + (updatedUser.userKey -> updatedUser))
meetings += (updatedMeeting.intId -> updatedMeeting)
}
meetings += (updatedMeeting.intId -> updatedMeeting)
}
}