From 241aac9f946d06fcb8cee84d6839253ad19ee929 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Tue, 3 Dec 2019 18:20:46 +0100 Subject: Fix files app LoadSidebar event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) Signed-off-by: npmbuildbot[bot] --- apps/files/lib/AppInfo/Application.php | 5 +-- apps/files/lib/Listener/LoadSidebarListener.php | 42 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 apps/files/lib/Listener/LoadSidebarListener.php (limited to 'apps/files/lib') diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index f4897d08e54..05d9e27ef06 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -27,14 +27,14 @@ namespace OCA\Files\AppInfo; -use OCA\Files\Activity\Helper; use OCA\Files\Capabilities; use OCA\Files\Collaboration\Resources\Listener; use OCA\Files\Collaboration\Resources\ResourceProvider; use OCA\Files\Controller\ApiController; -use OCA\Files\Controller\ViewController; use OCA\Files\Event\LoadAdditionalScriptsEvent; +use OCA\Files\Event\LoadSidebar; use OCA\Files\Listener\LegacyLoadAdditionalScriptsAdapter; +use OCA\Files\Listener\LoadSidebarListener; use OCA\Files\Notification\Notifier; use OCA\Files\Service\TagService; use OCP\AppFramework\App; @@ -97,6 +97,7 @@ class Application extends App { /** @var IEventDispatcher $dispatcher */ $dispatcher = $container->query(IEventDispatcher::class); $dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class); + $dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class); /** @var \OCP\Notification\IManager $notifications */ $notifications = $container->query(\OCP\Notification\IManager::class); diff --git a/apps/files/lib/Listener/LoadSidebarListener.php b/apps/files/lib/Listener/LoadSidebarListener.php new file mode 100644 index 00000000000..e70ad112335 --- /dev/null +++ b/apps/files/lib/Listener/LoadSidebarListener.php @@ -0,0 +1,42 @@ + + * + * @author John Molakvoæ + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Files\Listener; + +use OCA\Files\AppInfo\Application; +use OCA\Files\Event\LoadSidebar; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; +use OCP\Util; + +class LoadSidebarListener implements IEventListener { + public function handle(Event $event): void { + if (!($event instanceof LoadSidebar)) { + return; + } + + Util::addScript(Application::APP_ID, 'dist/sidebar'); + } + +} -- cgit v1.2.3