зеркало из https://github.com/nextcloud/spreed.git
Fix logout failure if active session was removed from room
If the user tries to immediately log out after being removed from a conversation in which she was active an exception could be thrown during the logout cleanup if no conversation is found for the session. If the exception is not caught then the logout will fail. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Родитель
b42625f2c9
Коммит
c8e8b7bd25
|
@ -23,6 +23,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Talk\Listener;
|
||||
|
||||
use OCA\Talk\Exceptions\ParticipantNotFoundException;
|
||||
use OCA\Talk\Exceptions\RoomNotFoundException;
|
||||
use OCA\Talk\Manager;
|
||||
use OCA\Talk\Participant;
|
||||
use OCA\Talk\TalkSession;
|
||||
|
@ -58,12 +60,16 @@ class BeforeUserLoggedOutListener implements IEventListener {
|
|||
|
||||
$sessionIds = $this->talkSession->getAllActiveSessions();
|
||||
foreach ($sessionIds as $sessionId) {
|
||||
$room = $this->manager->getRoomForSession($user->getUID(), $sessionId);
|
||||
$participant = $room->getParticipant($user->getUID());
|
||||
if ($participant->getInCallFlags() !== Participant::FLAG_DISCONNECTED) {
|
||||
$room->changeInCall($participant, Participant::FLAG_DISCONNECTED);
|
||||
try {
|
||||
$room = $this->manager->getRoomForSession($user->getUID(), $sessionId);
|
||||
$participant = $room->getParticipant($user->getUID());
|
||||
if ($participant->getInCallFlags() !== Participant::FLAG_DISCONNECTED) {
|
||||
$room->changeInCall($participant, Participant::FLAG_DISCONNECTED);
|
||||
}
|
||||
$room->leaveRoom($user->getUID(), $sessionId);
|
||||
} catch (RoomNotFoundException $e) {
|
||||
} catch (ParticipantNotFoundException $e) {
|
||||
}
|
||||
$room->leaveRoom($user->getUID(), $sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче