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

fix: Cannot enable bots in former 1:1 rooms #12893

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
3 changes: 2 additions & 1 deletion lib/Controller/BotController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use OCA\Talk\Model\BotServer;
use OCA\Talk\Model\BotServerMapper;
use OCA\Talk\ResponseDefinitions;
use OCA\Talk\Room;
use OCA\Talk\Service\BotService;
use OCA\Talk\Service\ChecksumVerificationService;
use OCA\Talk\Service\ParticipantService;
Expand Down Expand Up @@ -340,7 +341,7 @@ public function listBots(): DataResponse {
#[NoAdminRequired]
#[RequireLoggedInModeratorParticipant]
public function enableBot(int $botId): DataResponse {
if ($this->room->isFederatedConversation()) {
if ($this->room->isFederatedConversation() || $this->room->getType() === ROOM::TYPE_ONE_TO_ONE_FORMER) {
return new DataResponse([
'error' => 'room',
], Http::STATUS_BAD_REQUEST);
Expand Down
23 changes: 23 additions & 0 deletions tests/integration/features/chat-1/bots.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Feature: chat/bots
Background:
Given user "participant1" exists
Given user "participant2" exists

Scenario: Installing the call summary bot
Given invoking occ with "talk:bot:list"
Expand Down Expand Up @@ -357,3 +358,25 @@ Feature: chat/bots
Then the command failed with exit code 1
And the command output contains the text "Bot not found"

Scenario: Cannot enable bots in a former one-to-one room
Given invoking occ with "talk:bot:list"
Then the command was successful
And the command output is empty
Given user "participant1" creates room "room" (v4)
| roomType | 1 |
| invite | participant2 |
And user "participant1" is participant of room "room" (v4)
And user "participant2" is participant of room "room" (v4)
When user "participant2" is deleted
Then user "participant1" is participant of the following rooms (v4)
| id | type | participantType |
| room | 5 | 1 |
And invoking occ with "app:enable call_summary_bot"
And the command was successful
And invoking occ with "talk:bot:list room-name:room"
Then the command was successful
And the command output is empty
And user "participant1" sets up bot "Call summary" for room "room" with 400 (v1)
Given invoking occ with "talk:bot:list room-name:room"
And the command was successful
And the command output is empty
Loading