summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-01-24 12:36:46 +0100
committerJoas Schilling <coding@schilljs.com>2023-01-24 12:42:05 +0100
commitcbfa72d9f41f682ffc0a5e7ef17e76eff11321d6 (patch)
tree555415bd2c3f76585c92cb47a7f4015753ea4439 /lib
parentd277add2c01f24e2be2991bd6b6ed77779ef0d9b (diff)
Only do previous participant work when we actually have a session
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/RoomController.php43
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);