Browse Source

Allow to know when deleting might not be sufficient

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/4861/head
Joas Schilling 5 years ago
parent
commit
77f6a4ead3
No known key found for this signature in database GPG Key ID: 7076EA9751AACDDA
  1. 9
      lib/Controller/ChatController.php
  2. 5
      tests/php/Controller/ChatControllerTest.php

9
lib/Controller/ChatController.php

@ -29,6 +29,7 @@ use OCA\Talk\Chat\AutoComplete\Sorter;
use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Chat\MessageParser;
use OCA\Talk\GuestManager;
use OCA\Talk\MatterbridgeManager;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Model\Message;
use OCA\Talk\Model\Session;
@ -92,6 +93,9 @@ class ChatController extends AEnvironmentAwareController {
/** @var IUserStatusManager */
private $statusManager;
/** @var MatterbridgeManager */
protected $matterbridgeManager;
/** @var SearchPlugin */
private $searchPlugin;
@ -120,6 +124,7 @@ class ChatController extends AEnvironmentAwareController {
MessageParser $messageParser,
IManager $autoCompleteManager,
IUserStatusManager $statusManager,
MatterbridgeManager $matterbridgeManager,
SearchPlugin $searchPlugin,
ISearchResult $searchResult,
ITimeFactory $timeFactory,
@ -138,6 +143,7 @@ class ChatController extends AEnvironmentAwareController {
$this->messageParser = $messageParser;
$this->autoCompleteManager = $autoCompleteManager;
$this->statusManager = $statusManager;
$this->matterbridgeManager = $matterbridgeManager;
$this->searchPlugin = $searchPlugin;
$this->searchResult = $searchResult;
$this->timeFactory = $timeFactory;
@ -502,7 +508,8 @@ class ChatController extends AEnvironmentAwareController {
$data = $systemMessage->toArray();
$data['parent'] = $message->toArray();
return new DataResponse($data);
$bridge = $this->matterbridgeManager->getBridgeOfRoom($this->room);
return new DataResponse($data, $bridge['enabled'] ? Http::STATUS_ACCEPTED: Http::STATUS_OK);
}
/**

5
tests/php/Controller/ChatControllerTest.php

@ -28,6 +28,7 @@ use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Chat\MessageParser;
use OCA\Talk\Controller\ChatController;
use OCA\Talk\GuestManager;
use OCA\Talk\MatterbridgeManager;
use OCA\Talk\Model\Message;
use OCA\Talk\Participant;
use OCA\Talk\Room;
@ -75,6 +76,8 @@ class ChatControllerTest extends TestCase {
protected $autoCompleteManager;
/** @var IUserStatusManager|MockObject */
protected $statusManager;
/** @var MatterbridgeManager|MockObject */
protected $matterbridgeManager;
/** @var SearchPlugin|MockObject */
protected $searchPlugin;
/** @var ISearchResult|MockObject */
@ -109,6 +112,7 @@ class ChatControllerTest extends TestCase {
$this->messageParser = $this->createMock(MessageParser::class);
$this->autoCompleteManager = $this->createMock(IManager::class);
$this->statusManager = $this->createMock(IUserStatusManager::class);
$this->matterbridgeManager = $this->createMock(MatterbridgeManager::class);
$this->searchPlugin = $this->createMock(SearchPlugin::class);
$this->searchResult = $this->createMock(ISearchResult::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
@ -142,6 +146,7 @@ class ChatControllerTest extends TestCase {
$this->messageParser,
$this->autoCompleteManager,
$this->statusManager,
$this->matterbridgeManager,
$this->searchPlugin,
$this->searchResult,
$this->timeFactory,

Loading…
Cancel
Save