]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(loopup_server_connector): Migrate to IEventDispatcher
authorJoas Schilling <coding@schilljs.com>
Fri, 7 Jul 2023 09:28:02 +0000 (11:28 +0200)
committerJoas Schilling <coding@schilljs.com>
Wed, 19 Jul 2023 15:37:33 +0000 (17:37 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/lookup_server_connector/lib/AppInfo/Application.php

index edc2757c0a6c15e9d9f5913a44ae75d687b21cd1..8d6700c0eaad8bde329540e192528bf03cbb70d8 100644 (file)
@@ -34,9 +34,9 @@ use OCP\AppFramework\App;
 use OCP\AppFramework\Bootstrap\IBootContext;
 use OCP\AppFramework\Bootstrap\IBootstrap;
 use OCP\AppFramework\Bootstrap\IRegistrationContext;
+use OCP\EventDispatcher\IEventDispatcher;
 use OCP\IUser;
 use Psr\Container\ContainerInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\EventDispatcher\GenericEvent;
 
 class Application extends App implements IBootstrap {
@@ -56,15 +56,17 @@ class Application extends App implements IBootstrap {
        /**
         * @todo move the OCP events and then move the registration to `register`
         */
-       private function registerEventListeners(EventDispatcherInterface $dispatcher,
+       private function registerEventListeners(IEventDispatcher $dispatcher,
                                                                                        ContainerInterface $appContainer): void {
-               $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) {
-                       /** @var IUser $user */
-                       $user = $event->getSubject();
+               $dispatcher->addListener('OC\AccountManager::userUpdated', function ($event) use ($appContainer) {
+                       if ($event instanceof GenericEvent) {
+                               /** @var IUser $user */
+                               $user = $event->getSubject();
 
-                       /** @var UpdateLookupServer $updateLookupServer */
-                       $updateLookupServer = $appContainer->get(UpdateLookupServer::class);
-                       $updateLookupServer->userUpdated($user);
+                               /** @var UpdateLookupServer $updateLookupServer */
+                               $updateLookupServer = $appContainer->get(UpdateLookupServer::class);
+                               $updateLookupServer->userUpdated($user);
+                       }
                });
        }
 }