From 7a98a21d21d6f0a5c9869558e8bbeb0bb2d58cb7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 11 Dec 2023 12:57:51 +0100 Subject: fix(API): Remove unused member variables Signed-off-by: Joas Schilling --- lib/Chat/Notifier.php | 3 --- lib/Federation/FederationManager.php | 2 -- lib/Service/RoomService.php | 4 ++-- tests/php/Chat/NotifierTest.php | 9 --------- 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/lib/Chat/Notifier.php b/lib/Chat/Notifier.php index 5191ce7d9..68d6b9c3b 100644 --- a/lib/Chat/Notifier.php +++ b/lib/Chat/Notifier.php @@ -26,7 +26,6 @@ namespace OCA\Talk\Chat; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Files\Util; -use OCA\Talk\Manager; use OCA\Talk\Model\Attendee; use OCA\Talk\Model\Session; use OCA\Talk\Participant; @@ -50,13 +49,11 @@ use OCP\Notification\INotification; * prepares the notifications for display. */ class Notifier { - public function __construct( private INotificationManager $notificationManager, private IUserManager $userManager, private IGroupManager $groupManager, private ParticipantService $participantService, - private Manager $manager, private IConfig $config, private ITimeFactory $timeFactory, private Util $util, diff --git a/lib/Federation/FederationManager.php b/lib/Federation/FederationManager.php index ea4042d72..8676f38da 100644 --- a/lib/Federation/FederationManager.php +++ b/lib/Federation/FederationManager.php @@ -36,7 +36,6 @@ use OCA\Talk\Model\InvitationMapper; use OCA\Talk\Room; use OCA\Talk\Service\ParticipantService; use OCP\AppFramework\Db\DoesNotExistException; -use OCP\IConfig; use OCP\IUser; use OCP\Notification\IManager; use SensitiveParameter; @@ -58,7 +57,6 @@ class FederationManager { public const TOKEN_LENGTH = 64; public function __construct( - private IConfig $config, private Manager $manager, private ParticipantService $participantService, private InvitationMapper $invitationMapper, diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php index 7deea9cf6..d9c18fb36 100644 --- a/lib/Service/RoomService.php +++ b/lib/Service/RoomService.php @@ -83,10 +83,10 @@ class RoomService { // If room exists: Reuse that one, otherwise create a new one. $room = $this->manager->getOne2OneRoom($actor->getUID(), $targetUser->getUID()); $this->participantService->ensureOneToOneRoomIsFilled($room); - } catch (RoomNotFoundException $e) { + } catch (RoomNotFoundException) { if (!$this->shareManager->currentUserCanEnumerateTargetUser($actor, $targetUser)) { throw new RoomNotFoundException(); - }; + } $users = [$actor->getUID(), $targetUser->getUID()]; sort($users); diff --git a/tests/php/Chat/NotifierTest.php b/tests/php/Chat/NotifierTest.php index c2743b74e..c9554e11a 100644 --- a/tests/php/Chat/NotifierTest.php +++ b/tests/php/Chat/NotifierTest.php @@ -27,7 +27,6 @@ use OC\Comments\Comment; use OCA\Talk\Chat\Notifier; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Files\Util; -use OCA\Talk\Manager; use OCA\Talk\Model\Attendee; use OCA\Talk\Model\Session; use OCA\Talk\Participant; @@ -52,8 +51,6 @@ class NotifierTest extends TestCase { protected $groupManager; /** @var ParticipantService|MockObject */ protected $participantService; - /** @var Manager|MockObject */ - protected $manager; /** @var IConfig|MockObject */ protected $config; /** @var ITimeFactory|MockObject */ @@ -75,7 +72,6 @@ class NotifierTest extends TestCase { $this->groupManager = $this->createMock(IGroupManager::class); $this->participantService = $this->createMock(ParticipantService::class); - $this->manager = $this->createMock(Manager::class); $this->config = $this->createMock(IConfig::class); $this->timeFactory = $this->createMock(ITimeFactory::class); $this->util = $this->createMock(Util::class); @@ -93,7 +89,6 @@ class NotifierTest extends TestCase { $this->userManager, $this->groupManager, $this->participantService, - $this->manager, $this->config, $this->timeFactory, $this->util, @@ -106,7 +101,6 @@ class NotifierTest extends TestCase { $this->userManager, $this->groupManager, $this->participantService, - $this->manager, $this->config, $this->timeFactory, $this->util @@ -152,9 +146,6 @@ class NotifierTest extends TestCase { return new Participant($room, $attendee, null); }); - $this->manager->expects($this->any()) - ->method('getRoomById') - ->willReturn($room); return $room; } -- cgit v1.2.3