From 41cbc76ae335e892704ce9f7b1c10ca05ca55a08 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Mon, 25 Apr 2022 13:47:57 -0300 Subject: Move sharing listeners to static Signed-off-by: Vitor Mattos --- lib/Listener/RestrictStartingCalls.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/Listener/RestrictStartingCalls.php b/lib/Listener/RestrictStartingCalls.php index ed041ef0c..59e95639c 100644 --- a/lib/Listener/RestrictStartingCalls.php +++ b/lib/Listener/RestrictStartingCalls.php @@ -42,18 +42,16 @@ class RestrictStartingCalls { } public static function register(IEventDispatcher $dispatcher): void { - $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function (ModifyParticipantEvent $event) { - /** @var self $listener */ - $listener = \OC::$server->get(self::class); - $listener->checkStartCallPermissions($event); - }, 1000); + $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, [self::class, 'checkStartCallPermissions'], 1000); } /** * @param ModifyParticipantEvent $event * @throws ForbiddenException */ - public function checkStartCallPermissions(ModifyParticipantEvent $event): void { + public static function checkStartCallPermissions(ModifyParticipantEvent $event): void { + /** @var self $listener */ + $listener = \OC::$server->get(self::class); $room = $event->getRoom(); $participant = $event->getParticipant(); @@ -63,7 +61,7 @@ class RestrictStartingCalls { return; } - if (!$participant->canStartCall($this->config) && !$this->participantService->hasActiveSessionsInCall($room)) { + if (!$participant->canStartCall($listener->config) && !$listener->participantService->hasActiveSessionsInCall($room)) { throw new ForbiddenException('Can not start a call'); } } -- cgit v1.2.3