diff options
author | Joas Schilling <coding@schilljs.com> | 2020-02-27 18:45:33 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-03-02 14:47:38 +0300 |
commit | 1d5cf963565a7cd468712d6c9c647669ab46dce6 (patch) | |
tree | d44aae5a78e0ea3b1af7c9275364160ebd477171 /lib/Room.php | |
parent | 91e866b33d7eb274c6aaf9aa29c875cf4cc1790e (diff) |
Reset the in-call flags when the lobby kicks in
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Room.php')
-rw-r--r-- | lib/Room.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Room.php b/lib/Room.php index 5dea0be1a..d77380093 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -620,6 +620,17 @@ class Room { $this->dispatcher->dispatch(self::EVENT_AFTER_LOBBY_STATE_SET, $event); + if ($newState === Webinary::LOBBY_NON_MODERATORS) { + $participants = $this->getParticipantsInCall(); + foreach ($participants as $participant) { + if ($participant->hasModeratorPermissions()) { + continue; + } + + $this->changeInCall($participant, Participant::FLAG_DISCONNECTED); + } + } + return true; } @@ -985,6 +996,27 @@ class Room { } /** + * @return Participant[] + */ + public function getParticipantsInCall(): array { + $query = $this->db->getQueryBuilder(); + $query->select('*') + ->from('talk_participants') + ->where($query->expr()->eq('room_id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT))) + ->andWhere($query->expr()->neq('in_call', $query->createNamedParameter(Participant::FLAG_DISCONNECTED))); + + $result = $query->execute(); + + $participants = []; + while ($row = $result->fetch()) { + $participants[] = $this->manager->createParticipantObject($this, $row); + } + $result->closeCursor(); + + return $participants; + } + + /** * @param int $lastPing When the last ping is older than the given timestamp, the user is ignored * @return array[] Array of users with [users => [userId => [lastPing, sessionId]], guests => [[lastPing, sessionId]]] * @deprecated Use self::getParticipants() instead |