diff options
-rw-r--r-- | lib/Federation/CloudFederationProviderTalk.php | 10 | ||||
-rw-r--r-- | tests/php/Federation/FederationTest.php | 8 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/Federation/CloudFederationProviderTalk.php b/lib/Federation/CloudFederationProviderTalk.php index 7fa2b5ddc..a2fa48b62 100644 --- a/lib/Federation/CloudFederationProviderTalk.php +++ b/lib/Federation/CloudFederationProviderTalk.php @@ -28,6 +28,7 @@ namespace OCA\Talk\Federation; use Exception; use OCA\FederatedFileSharing\AddressHandler; use OCA\Talk\AppInfo\Application; +use OCA\Talk\Config; use OCA\Talk\Manager; use OCA\Talk\Model\Attendee; use OCA\Talk\Model\AttendeeMapper; @@ -60,6 +61,9 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { /** @var FederationManager */ private $federationManager; + /** @var Config */ + private $config; + /** @var INotificationManager */ private $notificationManager; @@ -79,6 +83,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { IUserManager $userManager, AddressHandler $addressHandler, FederationManager $federationManager, + Config $config, INotificationManager $notificationManager, IURLGenerator $urlGenerator, ParticipantService $participantService, @@ -88,6 +93,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { $this->userManager = $userManager; $this->addressHandler = $addressHandler; $this->federationManager = $federationManager; + $this->config = $config; $this->notificationManager = $notificationManager; $this->urlGenerator = $urlGenerator; $this->participantService = $participantService; @@ -108,7 +114,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { * @throws DBException */ public function shareReceived(ICloudFederationShare $share): string { - if (!$this->federationManager->isEnabled()) { + if (!$this->config->isFederationEnabled()) { throw new ProviderCouldNotAddShareException('Server does not support talk federation', '', Http::STATUS_SERVICE_UNAVAILABLE); } if (!in_array($share->getShareType(), $this->getSupportedShareTypes(), true)) { @@ -232,7 +238,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { * @throws ShareNotFound */ private function getAttendeeAndValidate(int $id, string $sharedSecret): Attendee { - if (!$this->federationManager->isEnabled()) { + if (!$this->config->isFederationEnabled()) { throw new ActionNotSupportedException('Server does not support Talk federation'); } diff --git a/tests/php/Federation/FederationTest.php b/tests/php/Federation/FederationTest.php index 8c107cc34..401562fe4 100644 --- a/tests/php/Federation/FederationTest.php +++ b/tests/php/Federation/FederationTest.php @@ -24,6 +24,7 @@ namespace OCA\Talk\Tests\php\Federation; use OC\Federation\CloudFederationShare; use OCA\FederatedFileSharing\AddressHandler; +use OCA\Talk\Config; use OCA\Talk\Federation\CloudFederationProviderTalk; use OCA\Talk\Federation\FederationManager; use OCA\Talk\Federation\Notifications; @@ -58,6 +59,9 @@ class FederationTest extends TestCase { /** @var ICloudFederationFactory */ protected $cloudFederationFactory; + /** @var Config */ + protected $config; + /** @var AddressHandler */ protected $addressHandler; @@ -81,6 +85,7 @@ class FederationTest extends TestCase { $this->addressHandler = $this->createMock(AddressHandler::class); $this->userManager = $this->createMock(IUserManager::class); $this->attendeeMapper = $this->createMock(AttendeeMapper::class); + $this->config = $this->createMock(Config::class); $this->notifications = new Notifications( $this->cloudFederationFactory, @@ -98,6 +103,7 @@ class FederationTest extends TestCase { $this->userManager, $this->addressHandler, $this->federationManager, + $this->config, $this->notificationManager, $this->createMock(IURLGenerator::class), $this->createMock(ParticipantService::class), @@ -230,7 +236,7 @@ class FederationTest extends TestCase { ->with($shareWithUser, $providerId, $roomType, $roomName, $name, $remote, $token) ->willReturn(20); - $this->federationManager->method('isEnabled') + $this->config->method('isFederationEnabled') ->willReturn(true); $this->addressHandler->expects($this->once()) |