Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] fix(breakout): stop breakout rooms on removing #11409

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
test-suite: ['callapi', 'chat-1', 'chat-2', 'command', 'conversation-1', 'conversation-2', 'conversation-3', 'conversation-4', 'conversation-5', 'federation', 'integration', 'sharing-1', 'sharing-2', 'sharing-3', 'sharing-4']
php-versions: ['8.2']
server-versions: ['stable28']
guests-versions: ['master']
guests-versions: ['stable28']
call-summary-bot-versions: ['main']
notifications-versions: ['stable28']

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
test-suite: ['callapi', 'chat-1', 'chat-2', 'command', 'conversation-1', 'conversation-2', 'conversation-3', 'conversation-4', 'conversation-5', 'federation', 'integration', 'sharing-1', 'sharing-2', 'sharing-3', 'sharing-4']
php-versions: ['8.2']
server-versions: ['stable28']
guests-versions: ['master']
guests-versions: ['stable28']
call-summary-bot-versions: ['main']
notifications-versions: ['stable28']

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
test-suite: ['callapi', 'chat-1', 'chat-2', 'command', 'conversation-1', 'conversation-2', 'conversation-3', 'conversation-4', 'conversation-5', 'federation', 'integration', 'sharing-1', 'sharing-2', 'sharing-3', 'sharing-4']
php-versions: ['8.3']
server-versions: ['stable28']
guests-versions: ['master']
guests-versions: ['stable28']
call-summary-bot-versions: ['main']
notifications-versions: ['stable28']

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
test-suite: ['callapi', 'chat-1', 'chat-2', 'command', 'conversation-1', 'conversation-2', 'conversation-3', 'conversation-4', 'conversation-5', 'federation', 'integration', 'sharing-1', 'sharing-2', 'sharing-3', 'sharing-4']
php-versions: ['8.2']
server-versions: ['stable28']
guests-versions: ['master']
guests-versions: ['stable28']
call-summary-bot-versions: ['main']
notifications-versions: ['stable28']

Expand Down
4 changes: 4 additions & 0 deletions lib/Service/BreakoutRoomService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCA\Talk\Webinary;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IL10N;
use OCP\Notification\IManager as INotificationManager;
Expand All @@ -48,6 +49,7 @@ public function __construct(
protected ParticipantService $participantService,
protected ChatManager $chatManager,
protected INotificationManager $notificationManager,
protected ITimeFactory $timeFactory,
protected IEventDispatcher $dispatcher,
protected IL10N $l,
) {
Expand Down Expand Up @@ -337,6 +339,7 @@ protected function createBreakoutRooms(Room $parent, int $amount): array {
public function removeBreakoutRooms(Room $parent): void {
$this->deleteBreakoutRooms($parent);
$this->roomService->setBreakoutRoomMode($parent, BreakoutRoom::MODE_NOT_CONFIGURED);
$this->roomService->setBreakoutRoomStatus($parent, BreakoutRoom::STATUS_STOPPED);
}

protected function deleteBreakoutRooms(Room $parent): void {
Expand Down Expand Up @@ -403,6 +406,7 @@ protected function setAssistanceRequest(Room $breakoutRoom, int $status): void {
}

$this->roomService->setBreakoutRoomStatus($breakoutRoom, $status);
$this->roomService->setLastActivity($breakoutRoom, $this->timeFactory->getDateTime());
}

/**
Expand Down
14 changes: 14 additions & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2896,6 +2896,20 @@ public function userCreatesBreakoutRooms(string $user, int $amount, string $mode
$this->assertStatusCode($this->response, $status);
}

/**
* @Then /^user "([^"]*)" removes breakout rooms from "([^"]*)" with (\d+) \((v1)\)$/
*
* @param string $user
* @param string $identifier
* @param int $status
* @param string $apiVersion
*/
public function userRemovesBreakoutRooms(string $user, string $identifier, int $status, string $apiVersion): void {
$this->setCurrentUser($user);
$this->sendRequest('DELETE', '/apps/spreed/api/' . $apiVersion . '/breakout-rooms/' . self::$identifierToToken[$identifier]);
$this->assertStatusCode($this->response, $status);
}

/**
* @Then /^user "([^"]*)" moves participants into different breakout rooms for "([^"]*)" with (\d+) \((v1)\)$/
*
Expand Down
34 changes: 34 additions & 0 deletions tests/integration/features/conversation-1/breakout-rooms.feature
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,40 @@ Feature: conversation/breakout-rooms
And user "participant1" is participant of the following rooms (v4)
And user "participant2" is participant of the following rooms (v4)

Scenario: Removing breakout rooms also stops them on the parent
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" is participant of the following unordered rooms (v4)
| type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
| 2 | class room | 0 | 0 | 0 |
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 unordered 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 "participant1" starts breakout rooms in room "class room" with 200 (v1)
And user "participant1" is participant of the following unordered rooms (v4)
| type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
| 2 | class room | 0 | 1 | 1 |
| 2 | Room 1 | 0 | 0 | 0 |
| 2 | Room 2 | 0 | 0 | 0 |
And user "participant2" is participant of the following unordered rooms (v4)
| type | name |
| 2 | class room |
| 2 | Room 1 |
When user "participant1" removes breakout rooms from "class room" with 200 (v1)
And user "participant1" is participant of the following unordered rooms (v4)
| type | name | lobbyState | breakoutRoomMode | breakoutRoomStatus |
| 2 | class room | 0 | 0 | 0 |

Scenario: Deleting a single breakout room unassigned the students from the mapping
Given user "participant1" creates room "class room" (v4)
| roomType | 2 |
Expand Down
5 changes: 5 additions & 0 deletions tests/php/Service/BreakoutRoomServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCA\Talk\Service\BreakoutRoomService;
use OCA\Talk\Service\ParticipantService;
use OCA\Talk\Service\RoomService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IL10N;
use OCP\Notification\IManager as INotificationManager;
Expand All @@ -53,6 +54,8 @@ class BreakoutRoomServiceTest extends TestCase {
private $chatManager;
/** @var INotificationManager|MockObject */
private $notificationManager;
/** @var ITimeFactory|MockObject */
protected $timeFactory;
/** @var IEventDispatcher|MockObject */
private $dispatcher;
/** @var IL10N|MockObject */
Expand All @@ -67,6 +70,7 @@ public function setUp(): void {
$this->participantService = $this->createMock(ParticipantService::class);
$this->chatManager = $this->createMock(ChatManager::class);
$this->notificationManager = $this->createMock(INotificationManager::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->dispatcher = $this->createMock(IEventDispatcher::class);
$this->l = $this->createMock(IL10N::class);
$this->service = new BreakoutRoomService(
Expand All @@ -76,6 +80,7 @@ public function setUp(): void {
$this->participantService,
$this->chatManager,
$this->notificationManager,
$this->timeFactory,
$this->dispatcher,
$this->l
);
Expand Down
Loading