diff options
Diffstat (limited to 'apps/comments/lib/AppInfo/Application.php')
-rw-r--r-- | apps/comments/lib/AppInfo/Application.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/comments/lib/AppInfo/Application.php b/apps/comments/lib/AppInfo/Application.php index 916345e4a5f..793d1e9f7be 100644 --- a/apps/comments/lib/AppInfo/Application.php +++ b/apps/comments/lib/AppInfo/Application.php @@ -26,10 +26,13 @@ namespace OCA\Comments\AppInfo; use OCA\Comments\Controller\Notifications; use OCA\Comments\EventHandler; use OCA\Comments\JSSettingsHelper; +use OCA\Comments\Listener\LoadAdditionalScripts; use OCA\Comments\Notification\Notifier; use OCA\Comments\Search\Provider; +use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCP\AppFramework\App; use OCP\Comments\CommentsEntityEvent; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Util; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -48,7 +51,8 @@ class Application extends App { public function register() { $server = $this->getContainer()->getServer(); - $dispatcher = $server->getEventDispatcher(); + /** @var IEventDispatcher $newDispatcher */ + $dispatcher = $server->query(IEventDispatcher::class); $this->registerSidebarScripts($dispatcher); $this->registerDavEntity($dispatcher); $this->registerNotifier(); @@ -57,16 +61,11 @@ class Application extends App { $server->getSearch()->registerProvider(Provider::class, ['apps' => ['files']]); } - protected function registerSidebarScripts(EventDispatcherInterface $dispatcher) { - $dispatcher->addListener( - 'OCA\Files::loadAdditionalScripts', - function() { - Util::addScript('comments', 'comments'); - } - ); + protected function registerSidebarScripts(IEventDispatcher $dispatcher) { + $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScripts::class); } - protected function registerDavEntity(EventDispatcherInterface $dispatcher) { + protected function registerDavEntity(IEventDispatcher $dispatcher) { $dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { $event->addEntityCollection('files', function($name) { $nodes = \OC::$server->getUserFolder()->getById((int)$name); |