summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/conversation.md2
-rw-r--r--lib/Service/RoomService.php11
-rw-r--r--tests/integration/features/conversation/breakout-rooms.feature24
3 files changed, 36 insertions, 1 deletions
diff --git a/docs/conversation.md b/docs/conversation.md
index bab915cc6..cc4488ba1 100644
--- a/docs/conversation.md
+++ b/docs/conversation.md
@@ -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}`
diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php
index 485596627..f8026366c 100644
--- a/lib/Service/RoomService.php
+++ b/lib/Service/RoomService.php
@@ -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();
diff --git a/tests/integration/features/conversation/breakout-rooms.feature b/tests/integration/features/conversation/breakout-rooms.feature
index 31b1870cd..c05185f7c 100644
--- a/tests/integration/features/conversation/breakout-rooms.feature
+++ b/tests/integration/features/conversation/breakout-rooms.feature
@@ -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)