diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Chat/Changelog/Listener.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Chat/Changelog/Listener.php b/lib/Chat/Changelog/Listener.php index b534abdd0..7d31d7650 100644 --- a/lib/Chat/Changelog/Listener.php +++ b/lib/Chat/Changelog/Listener.php @@ -29,13 +29,7 @@ use OCP\EventDispatcher\IEventDispatcher; class Listener { public static function register(IEventDispatcher $dispatcher): void { - $dispatcher->addListener(RoomController::EVENT_BEFORE_ROOMS_GET, static function (UserEvent $event) { - $userId = $event->getUserId(); - - /** @var Listener $listener */ - $listener = \OC::$server->get(self::class); - $listener->preGetRooms($userId); - }, -100); + $dispatcher->addListener(RoomController::EVENT_BEFORE_ROOMS_GET, [self::class, 'updateChangelog'], -100); } protected Manager $manager; @@ -44,6 +38,14 @@ class Listener { $this->manager = $manager; } + public static function updateChangelog(UserEvent $event): void { + $userId = $event->getUserId(); + + /** @var Listener $listener */ + $listener = \OC::$server->get(self::class); + $listener->preGetRooms($userId); + } + public function preGetRooms(string $userId): void { if (!$this->manager->userHasNewChangelog($userId)) { return; |