diff options
Diffstat (limited to 'lib/Controller/RoomController.php')
-rw-r--r-- | lib/Controller/RoomController.php | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index d5f350129..1ae553c18 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -1446,35 +1446,34 @@ class RoomController extends AEnvironmentAwareController { $previousParticipant = null; /** @var Session|null $previousSession */ $previousSession = null; - if ($this->userId !== null) { - try { - $previousParticipant = $this->participantService->getParticipant($room, $this->userId, $sessionId); - $previousSession = $previousParticipant->getSession(); - } catch (ParticipantNotFoundException $e) { - } - } else { + + if ($sessionId !== null) { try { - $previousParticipant = $this->participantService->getParticipantBySession($room, $sessionId); + if ($this->userId !== null) { + $previousParticipant = $this->participantService->getParticipant($room, $this->userId, $sessionId); + } else { + $previousParticipant = $this->participantService->getParticipantBySession($room, $sessionId); + } $previousSession = $previousParticipant->getSession(); } catch (ParticipantNotFoundException $e) { } - } - if ($previousSession instanceof Session && $previousSession->getSessionId() !== '0') { - if ($force === false && $previousSession->getInCall() !== Participant::FLAG_DISCONNECTED) { - // Previous session is/was active in the call, show a warning - return new DataResponse([ - 'sessionId' => $previousSession->getSessionId(), - 'inCall' => $previousSession->getInCall(), - 'lastPing' => $previousSession->getLastPing(), - ], Http::STATUS_CONFLICT); - } + if ($previousSession instanceof Session && $previousSession->getSessionId() !== '0') { + if ($force === false && $previousSession->getInCall() !== Participant::FLAG_DISCONNECTED) { + // Previous session is/was active in the call, show a warning + return new DataResponse([ + 'sessionId' => $previousSession->getSessionId(), + 'inCall' => $previousSession->getInCall(), + 'lastPing' => $previousSession->getLastPing(), + ], Http::STATUS_CONFLICT); + } - if ($previousSession->getInCall() !== Participant::FLAG_DISCONNECTED) { - $this->participantService->changeInCall($room, $previousParticipant, Participant::FLAG_DISCONNECTED); - } + if ($previousSession->getInCall() !== Participant::FLAG_DISCONNECTED) { + $this->participantService->changeInCall($room, $previousParticipant, Participant::FLAG_DISCONNECTED); + } - $this->participantService->leaveRoomAsSession($room, $previousParticipant, true); + $this->participantService->leaveRoomAsSession($room, $previousParticipant, true); + } } $user = $this->userManager->get($this->userId); |