summaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2019-12-04 12:47:40 +0100
committerGitHub <noreply@github.com>2019-12-04 12:47:40 +0100
commitbfb9ccec1fce79bb068b2a58ba597a63de8412ed (patch)
treee2cc29391e1c1b00ddcdb6563411e3cbdc29b834 /apps/files/lib
parent76b78edd40fcb5dbe7f0434cbc41d2e291acfec1 (diff)
parent46ce797197571f2cf873ca116e31165ea6a395bc (diff)
downloadnextcloud-server-bfb9ccec1fce79bb068b2a58ba597a63de8412ed.tar.gz
nextcloud-server-bfb9ccec1fce79bb068b2a58ba597a63de8412ed.zip
Fix files app LoadSidebar event (#18213)
Fix files app LoadSidebar event
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/AppInfo/Application.php5
-rw-r--r--apps/files/lib/Listener/LoadSidebarListener.php42
2 files changed, 45 insertions, 2 deletions
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 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019, John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+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');
+ }
+
+}