diff options
author | Joas Schilling <coding@schilljs.com> | 2020-06-15 16:01:28 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-07-01 11:00:23 +0300 |
commit | ee2632ba40c4885ec477e8b02e4c038620eb5960 (patch) | |
tree | 03a3350d9bd16433de406f72da4283cb80872c23 /lib/Room.php | |
parent | 5bce99b2d04e8010ec81113c69503395e4a09148 (diff) |
Further pass on the sessionId to leaveRoomAsParticipant
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Room.php')
-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(); |