Browse Source

fix(API): Remove unused member variables

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/11192/head
Joas Schilling 2 years ago
parent
commit
7a98a21d21
No known key found for this signature in database GPG Key ID: 74434EFE0D2E2205
  1. 3
      lib/Chat/Notifier.php
  2. 2
      lib/Federation/FederationManager.php
  3. 4
      lib/Service/RoomService.php
  4. 9
      tests/php/Chat/NotifierTest.php

3
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,

2
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,

4
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);

9
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;
}

Loading…
Cancel
Save