diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-08-25 14:33:12 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-08-26 12:20:06 +0200 |
commit | 85f73b06b6031cc75ff5343d8b007447fab26caa (patch) | |
tree | a3dcee481bbe883710337164fb2be989ee7491be /tests | |
parent | be6fa63298d89f020b4567ceb864e27bcc4f2310 (diff) |
Fix not leaving previous session when joining the same room again
When the same room is joined again from the same PHP session the room is
left with the previous Nextcloud session before joining with the new
one. However, "disinvite" messages were not sent to the external signaling
server for regular users, so their UI was not updated to show that the
previous Nextcloud session was kicked out from the conversation.
Note, however, that as a "disinvite" message is now sent the UI will
show a "conversation not found" message rather than a "duplicated
session" state.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/php/Signaling/BackendNotifierTest.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/php/Signaling/BackendNotifierTest.php b/tests/php/Signaling/BackendNotifierTest.php index 26e665b46..e450d18f2 100644 --- a/tests/php/Signaling/BackendNotifierTest.php +++ b/tests/php/Signaling/BackendNotifierTest.php @@ -352,6 +352,50 @@ class BackendNotifierTest extends TestCase { $this->assertNoMessageOfTypeWasSent($room, 'disinvite'); } + public function testRoomDisinviteOnLeaveOfNormalUserWithDuplicatedSession() { + /** @var IUser|MockObject $testUser */ + $testUser = $this->createMock(IUser::class); + $testUser->expects($this->any()) + ->method('getUID') + ->willReturn($this->userId); + + $roomService = $this->createMock(RoomService::class); + $roomService->method('verifyPassword') + ->willReturn(['result' => true, 'url' => '']); + + $room = $this->manager->createRoom(Room::TYPE_PUBLIC); + $this->participantService->addUsers($room, [[ + 'actorType' => 'users', + 'actorId' => $this->userId, + ]]); + $participant = $this->participantService->joinRoom($roomService, $room, $testUser, ''); + $this->controller->clearRequests(); + $this->participantService->leaveRoomAsSession($room, $participant, true); + + $this->assertMessageWasSent($room, [ + 'type' => 'disinvite', + 'disinvite' => [ + 'sessionids' => [ + $participant->getSession()->getSessionId(), + ], + 'alluserids' => [ + $this->userId, + ], + '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 testRoomDisinviteOnLeaveOfSelfJoinedUser() { /** @var IUser|MockObject $testUser */ $testUser = $this->createMock(IUser::class); |