Browse Source
Delete breakout rooms when deleting the parent
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/8462/head
Joas Schilling
3 years ago
No known key found for this signature in database
GPG Key ID: C400AAF20C1BB6FC
3 changed files with
36 additions and
1 deletions
-
docs/conversation.md
-
lib/Service/RoomService.php
-
tests/integration/features/conversation/breakout-rooms.feature
|
|
@ -193,6 +193,8 @@ Get all (for moderators and in case of "free selection) or the assigned breakout |
|
|
|
|
|
|
|
## Delete a conversation |
|
|
|
|
|
|
|
*Note:* Deleting a conversation that is the parent of breakout rooms, will also delete them. |
|
|
|
|
|
|
|
* Method: `DELETE` |
|
|
|
* Endpoint: `/room/{token}` |
|
|
|
|
|
|
|
|
|
@ -794,14 +794,23 @@ class RoomService { |
|
|
|
public function deleteRoom(Room $room): void { |
|
|
|
$event = new RoomEvent($room); |
|
|
|
$this->dispatcher->dispatch(Room::EVENT_BEFORE_ROOM_DELETE, $event); |
|
|
|
$delete = $this->db->getQueryBuilder(); |
|
|
|
|
|
|
|
// Delete all breakout rooms when deleting a parent room
|
|
|
|
if ($room->getBreakoutRoomMode() !== BreakoutRoom::MODE_NOT_CONFIGURED) { |
|
|
|
$breakoutRooms = $this->manager->getMultipleRoomsByObject(BreakoutRoom::PARENT_OBJECT_TYPE, $room->getToken()); |
|
|
|
foreach ($breakoutRooms as $breakoutRoom) { |
|
|
|
$this->deleteRoom($breakoutRoom); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Delete attendees
|
|
|
|
$delete = $this->db->getQueryBuilder(); |
|
|
|
$delete->delete('talk_attendees') |
|
|
|
->where($delete->expr()->eq('room_id', $delete->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT))); |
|
|
|
$delete->executeStatement(); |
|
|
|
|
|
|
|
// Delete room
|
|
|
|
$delete = $this->db->getQueryBuilder(); |
|
|
|
$delete->delete('talk_rooms') |
|
|
|
->where($delete->expr()->eq('id', $delete->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT))); |
|
|
|
$delete->executeStatement(); |
|
|
|
|
|
@ -492,3 +492,27 @@ Feature: conversation/breakout-rooms |
|
|
|
| 2 | Room 1 | |
|
|
|
And user "participant1" starts breakout rooms in room "class room" with 200 (v1) |
|
|
|
When user "participant2" switches in room "class room" to breakout room "Room 1" with 400 (v1) |
|
|
|
|
|
|
|
Scenario: Deleting the parent also deletes all breakout rooms |
|
|
|
Given user "participant1" creates room "class room" (v4) |
|
|
|
| roomType | 2 | |
|
|
|
| roomName | class room | |
|
|
|
And user "participant1" adds user "participant2" to room "class room" with 200 (v4) |
|
|
|
And user "participant1" sees the following attendees in room "class room" with 200 (v4) |
|
|
|
| actorType | actorId | participantType | |
|
|
|
| users | participant1 | 1 | |
|
|
|
| users | participant2 | 3 | |
|
|
|
And user "participant1" creates 2 automatic breakout rooms for "class room" with 200 (v1) |
|
|
|
| users::participant2 | 0 | |
|
|
|
And user "participant1" is participant of the following rooms (v4) |
|
|
|
| type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus | |
|
|
|
| 2 | class room | 0 | 1 | 0 | |
|
|
|
| 2 | Room 1 | 1 | 0 | 0 | |
|
|
|
| 2 | Room 2 | 1 | 0 | 0 | |
|
|
|
And user "participant2" is participant of the following rooms (v4) |
|
|
|
| type | name | |
|
|
|
| 2 | class room | |
|
|
|
| 2 | Room 1 | |
|
|
|
When user "participant1" deletes room "class room" with 200 (v4) |
|
|
|
And user "participant1" is participant of the following rooms (v4) |
|
|
|
And user "participant2" is participant of the following rooms (v4) |