Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-04-20 17:01:54 +0300
committerGitHub <noreply@github.com>2022-04-20 17:01:54 +0300
commit0e9ef95f419413649cc025ccb2db25ecd4b51342 (patch)
tree36057d524137ec5dee743301ed8688d01b46b9e9 /lib
parentb6247b0fd27c65318598b415230da90df18b1512 (diff)
parent3737915a917c600735e160116aa62780c1f32593 (diff)
Merge pull request #7170 from nextcloud/feature/move-changelog-listeners-annonymous-functions-to-static
Move changelog listener anonymous function to static
Diffstat (limited to 'lib')
-rw-r--r--lib/Chat/Changelog/Listener.php16
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;