diff options
author | Joas Schilling <coding@schilljs.com> | 2020-06-15 16:01:28 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-07-01 14:11:39 +0300 |
commit | 77e6ecfaf32610fa44050691e2d50d632a23a6b9 (patch) | |
tree | f7e5e6204089f6ec37100cdee0a8e9926946d9ea | |
parent | 18c10ecc63c1ad2a4318e86c2e22878c770521bd (diff) |
Further pass on the sessionId to leaveRoomAsParticipant
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/Room.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Room.php b/lib/Room.php index 1d5507384..ca02918e8 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -839,13 +839,14 @@ class Room { return; } - $this->leaveRoomAsParticipant($participant); + $this->leaveRoomAsParticipant($participant, $sessionId); } /** * @param Participant $participant + * @param string|null $sessionId */ - public function leaveRoomAsParticipant(Participant $participant): void { + public function leaveRoomAsParticipant(Participant $participant, ?string $sessionId = null): void { $event = new ParticipantEvent($this, $participant); $this->dispatcher->dispatch(self::EVENT_BEFORE_ROOM_DISCONNECT, $event); @@ -857,7 +858,9 @@ class Room { ->where($query->expr()->eq('user_id', $query->createNamedParameter($participant->getUser()))) ->andWhere($query->expr()->eq('room_id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT))) ->andWhere($query->expr()->neq('participant_type', $query->createNamedParameter(Participant::USER_SELF_JOINED, IQueryBuilder::PARAM_INT))); - if ($participant->getSessionId() !== '0') { + if ($sessionId !== null && $sessionId !== '0') { + $query->andWhere($query->expr()->eq('session_id', $query->createNamedParameter($sessionId))); + } elseif ($participant->getSessionId() !== '0') { $query->andWhere($query->expr()->eq('session_id', $query->createNamedParameter($participant->getSessionId()))); } $query->execute(); @@ -868,7 +871,9 @@ class Room { ->where($query->expr()->eq('user_id', $query->createNamedParameter($participant->getUser()))) ->andWhere($query->expr()->eq('room_id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT))) ->andWhere($query->expr()->eq('participant_type', $query->createNamedParameter(Participant::USER_SELF_JOINED, IQueryBuilder::PARAM_INT))); - if ($participant->getSessionId() !== '0') { + if ($sessionId !== null && $sessionId !== '0') { + $query->andWhere($query->expr()->eq('session_id', $query->createNamedParameter($sessionId))); + } elseif ($participant->getSessionId() !== '0') { $query->andWhere($query->expr()->eq('session_id', $query->createNamedParameter($participant->getSessionId()))); } $query->execute(); |