mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
Only do previous participant work when we actually have a session
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
d277add2c0
commit
cbfa72d9f4
1 changed files with 21 additions and 22 deletions
|
|
@ -1446,35 +1446,34 @@ class RoomController extends AEnvironmentAwareController {
|
|||
$previousParticipant = null;
|
||||
/** @var Session|null $previousSession */
|
||||
$previousSession = null;
|
||||
if ($this->userId !== null) {
|
||||
|
||||
if ($sessionId !== null) {
|
||||
try {
|
||||
$previousParticipant = $this->participantService->getParticipant($room, $this->userId, $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) {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue