Browse Source

Remove attendees from breakout rooms as well

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/8462/head
Joas Schilling 3 years ago
parent
commit
5d63a47b7d
No known key found for this signature in database GPG Key ID: C400AAF20C1BB6FC
  1. 5
      lib/Service/BreakoutRoomService.php
  2. 22
      lib/Service/ParticipantService.php
  3. 37
      tests/integration/features/conversation/breakout-rooms.feature

5
lib/Service/BreakoutRoomService.php

@ -543,10 +543,11 @@ class BreakoutRoomService {
* @param Room $parent
* @param string $actorType
* @param string $actorId
* @param bool $throwOnModerator
* @return void
* @throws InvalidArgumentException When being used for a moderator
*/
public function removeAttendeeFromBreakoutRoom(Room $parent, string $actorType, string $actorId): void {
public function removeAttendeeFromBreakoutRoom(Room $parent, string $actorType, string $actorId, bool $throwOnModerator = true): void {
$breakoutRooms = $this->manager->getMultipleRoomsByObject(BreakoutRoom::PARENT_OBJECT_TYPE, $parent->getToken());
foreach ($breakoutRooms as $breakoutRoom) {
@ -557,7 +558,7 @@ class BreakoutRoomService {
$actorId
);
if ($participant->hasModeratorPermissions()) {
if ($throwOnModerator && $participant->hasModeratorPermissions()) {
throw new \InvalidArgumentException('moderator');
}

22
lib/Service/ParticipantService.php

@ -787,6 +787,17 @@ class ParticipantService {
$sessions = $this->sessionService->getAllSessionsForAttendee($participant->getAttendee());
if ($room->getBreakoutRoomMode() !== BreakoutRoom::MODE_NOT_CONFIGURED) {
/** @var BreakoutRoomService $breakoutRoomService */
$breakoutRoomService = Server::get(BreakoutRoomService::class);
$breakoutRoomService->removeAttendeeFromBreakoutRoom(
$room,
$participant->getAttendee()->getActorType(),
$participant->getAttendee()->getActorId(),
false
);
}
if ($isUser) {
$user = $this->userManager->get($participant->getAttendee()->getActorId());
$event = new RemoveUserEvent($room, $participant, $user, $reason, $sessions);
@ -920,6 +931,17 @@ class ParticipantService {
$attendee = $participant->getAttendee();
$sessions = $this->sessionService->getAllSessionsForAttendee($attendee);
if ($room->getBreakoutRoomMode() !== BreakoutRoom::MODE_NOT_CONFIGURED) {
/** @var BreakoutRoomService $breakoutRoomService */
$breakoutRoomService = Server::get(BreakoutRoomService::class);
$breakoutRoomService->removeAttendeeFromBreakoutRoom(
$room,
$attendee->getActorType(),
$attendee->getActorId(),
false
);
}
$event = new RemoveUserEvent($room, $participant, $user, $reason, $sessions);
$this->dispatcher->dispatch(Room::EVENT_BEFORE_USER_REMOVE, $event);

37
tests/integration/features/conversation/breakout-rooms.feature

@ -681,6 +681,43 @@ Feature: conversation/breakout-rooms
| 2 | class room | 0 | 1 | 0 |
| 2 | Room 2 | 1 | 0 | 0 |
Scenario: Removing a user from the parent also removes them from the breakout room
Given user "participant1" creates room "class room" (v4)
| roomType | 2 |
| roomName | class room |
When user "participant1" adds user "participant2" to room "class room" with 200 (v4)
When user "participant1" adds user "participant3" to room "class room" with 200 (v4)
When user "participant1" adds user "participant4" to room "class room" with 200 (v4)
Then user "participant1" sees the following attendees in room "class room" with 200 (v4)
| actorType | actorId | participantType |
| users | participant1 | 1 |
| users | participant2 | 3 |
| users | participant3 | 3 |
| users | participant4 | 3 |
And user "participant1" promotes "participant2" in room "class room" with 200 (v4)
When user "participant1" creates 2 manual breakout rooms for "class room" with 200 (v1)
| users::participant3 | 0 |
| users::participant4 | 1 |
And user "participant2" is participant of the following rooms (v4)
| type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
| 2 | class room | 0 | 2 | 0 |
| 2 | Room 1 | 1 | 0 | 0 |
| 2 | Room 2 | 1 | 0 | 0 |
And user "participant3" is participant of the following rooms (v4)
| type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
| 2 | class room | 0 | 2 | 0 |
| 2 | Room 1 | 1 | 0 | 0 |
And user "participant4" is participant of the following rooms (v4)
| type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
| 2 | class room | 0 | 2 | 0 |
| 2 | Room 2 | 1 | 0 | 0 |
When user "participant1" removes user "participant2" from room "class room" with 200 (v4)
And user "participant1" removes user "participant3" from room "class room" with 200 (v4)
And user "participant4" removes themselves from room "class room" with 200 (v4)
Then user "participant2" is participant of the following rooms (v4)
And user "participant3" is participant of the following rooms (v4)
And user "participant4" is participant of the following rooms (v4)
Scenario: Only users with normal level can be moved between breakout rooms
Given user "participant1" creates room "class room" (v4)
| roomType | 2 |

Loading…
Cancel
Save