diff --git a/lib/Signaling/Listener.php b/lib/Signaling/Listener.php index 6155f5fdc85..cf4d33a9ffe 100644 --- a/lib/Signaling/Listener.php +++ b/lib/Signaling/Listener.php @@ -227,18 +227,11 @@ protected static function registerExternalSignaling(IEventDispatcher $dispatcher $sessionIds = []; - /** @var SessionService $sessionService */ - $sessionService = \OC::$server->get(SessionService::class); - $sessions = $sessionService->getAllSessionsForAttendee($event->getParticipant()->getAttendee()); + $sessions = $event->getSessions(); foreach ($sessions as $session) { $sessionIds[] = $session->getSessionId(); } - if ($event->getParticipant()->getSession()) { - $sessionIds[] = $event->getParticipant()->getSession()->getSessionId(); - $notifier->roomSessionsRemoved($event->getRoom(), $sessionIds); - } - if (!empty($sessionIds)) { $notifier->roomSessionsRemoved($event->getRoom(), $sessionIds); } diff --git a/tests/php/Signaling/BackendNotifierTest.php b/tests/php/Signaling/BackendNotifierTest.php index fd2be706b1d..14f73517315 100644 --- a/tests/php/Signaling/BackendNotifierTest.php +++ b/tests/php/Signaling/BackendNotifierTest.php @@ -305,6 +305,35 @@ public function testRoomDisinvite() { ]); } + public function testRoomDisinviteOnRemovalOfGuest() { + $room = $this->manager->createRoom(Room::TYPE_PUBLIC); + $participant = $this->participantService->joinRoomAsNewGuest($room, ''); + $this->controller->clearRequests(); + $this->participantService->removeAttendee($room, $participant, Room::PARTICIPANT_REMOVED); + + $this->assertMessageWasSent($room, [ + 'type' => 'disinvite', + 'disinvite' => [ + 'sessionids' => [ + $participant->getSession()->getSessionId(), + ], + 'alluserids' => [ + ], + 'properties' => [ + 'name' => $room->getDisplayName(''), + 'type' => $room->getType(), + 'lobby-state' => Webinary::LOBBY_NONE, + 'lobby-timer' => null, + 'read-only' => Room::READ_WRITE, + 'listable' => Room::LISTABLE_NONE, + 'active-since' => null, + 'sip-enabled' => 0, + 'participant-list' => 'refresh', + ], + ], + ]); + } + public function testNoRoomDisinviteOnLeaveOfNormalUser() { /** @var IUser|MockObject $testUser */ $testUser = $this->createMock(IUser::class);