Fix participant sessions not sent to the HPB

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-09-22 02:55:22 +02:00
Родитель d523b4e622
Коммит d9f3ed06b8
2 изменённых файлов: 34 добавлений и 7 удалений

Просмотреть файл

@ -224,17 +224,11 @@ class Listener {
$sessionIds = []; $sessionIds = [];
$sessionService = Server::get(SessionService::class); $sessions = $event->getSessions();
$sessions = $sessionService->getAllSessionsForAttendee($event->getParticipant()->getAttendee());
foreach ($sessions as $session) { foreach ($sessions as $session) {
$sessionIds[] = $session->getSessionId(); $sessionIds[] = $session->getSessionId();
} }
if ($event->getParticipant()->getSession()) {
$sessionIds[] = $event->getParticipant()->getSession()->getSessionId();
$notifier->roomSessionsRemoved($event->getRoom(), $sessionIds);
}
if (!empty($sessionIds)) { if (!empty($sessionIds)) {
$notifier->roomSessionsRemoved($event->getRoom(), $sessionIds); $notifier->roomSessionsRemoved($event->getRoom(), $sessionIds);
} }

Просмотреть файл

@ -329,6 +329,39 @@ class BackendNotifierTest extends TestCase {
]); ]);
} }
public function testRoomDisinviteOnRemovalOfGuest() {
$roomService = $this->createMock(RoomService::class);
$roomService->method('verifyPassword')
->willReturn(['result' => true, 'url' => '']);
$room = $this->manager->createRoom(Room::TYPE_PUBLIC);
$participant = $this->participantService->joinRoomAsNewGuest($roomService, $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() { public function testNoRoomDisinviteOnLeaveOfNormalUser() {
/** @var IUser|MockObject $testUser */ /** @var IUser|MockObject $testUser */
$testUser = $this->createMock(IUser::class); $testUser = $this->createMock(IUser::class);