Merge pull request #18859 from gustavotrott/fix-graphql-webcamsOnlyForModerator

fix (graphql-server): Graphql not updating webcamsOnlyForModerator
This commit is contained in:
Gustavo Trott 2023-10-03 08:48:43 -03:00 committed by GitHub
commit 4794d105d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 5 deletions

View File

@ -3,8 +3,9 @@ package org.bigbluebutton.core.apps.webcam
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.apps.PermissionCheck
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.db.MeetingUsersPoliciesDAO
import org.bigbluebutton.core.running.LiveMeeting
import org.bigbluebutton.core2.message.senders.{ MsgBuilder }
import org.bigbluebutton.core2.message.senders.MsgBuilder
trait UpdateWebcamsOnlyForModeratorCmdMsgHdlr {
this: WebcamApp2x =>
@ -50,6 +51,8 @@ trait UpdateWebcamsOnlyForModeratorCmdMsgHdlr {
case Some(value) => {
log.info(s"Change webcams only for moderator status. meetingId=${meetingId} value=${value}")
MeetingUsersPoliciesDAO.updateWebcamsOnlyForModerator(meetingId, msg.body.webcamsOnlyForModerator)
if (value) {
val notifyEvent = MsgBuilder.buildNotifyAllInMeetingEvtMsg(
meetingId,

View File

@ -73,8 +73,8 @@ object MeetingUsersPoliciesDAO {
.map(u => u.guestPolicy)
.update(policy.policy)
).onComplete {
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated on meeting_usersPolicies table!")
case Failure(e) => DatabaseConnection.logger.error(s"Error updating meeting_usersPolicies: $e")
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated guestPolicy on meeting_usersPolicies table!")
case Failure(e) => DatabaseConnection.logger.error(s"Error updating guestPolicy on meeting_usersPolicies: $e")
}
}
@ -90,8 +90,20 @@ object MeetingUsersPoliciesDAO {
}
)
).onComplete {
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated on meeting_usersPolicies table!")
case Failure(e) => DatabaseConnection.logger.error(s"Error updating meeting_usersPolicies: $e")
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated guestLobbyMessage on meeting_usersPolicies table!")
case Failure(e) => DatabaseConnection.logger.error(s"Error updating guestLobbyMessage on meeting_usersPolicies: $e")
}
}
def updateWebcamsOnlyForModerator(meetingId: String, webcamsOnlyForModerator: Boolean) = {
DatabaseConnection.db.run(
TableQuery[MeetingUsersPoliciesDbTableDef]
.filter(_.meetingId === meetingId)
.map(u => u.webcamsOnlyForModerator)
.update(webcamsOnlyForModerator)
).onComplete {
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated webcamsOnlyForModerator on meeting_usersPolicies table!")
case Failure(e) => DatabaseConnection.logger.error(s"Error updating webcamsOnlyForModerator on meeting_usersPolicies: $e")
}
}