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:
authorMarco Ambrosini <marcoambrosini@pm.me>2019-12-11 19:32:40 +0300
committerMarco Ambrosini <marcoambrosini@pm.me>2019-12-13 11:17:58 +0300
commite1ff175908c66750a45089eb479ef97c6b5266b4 (patch)
tree744e6437e0cb2ec5561e30468085a3d285220a15 /lib
parent64d3dec45b422f4a2f66cec582a8781e0587ebf2 (diff)
Add talk sidebar tab for files
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
Diffstat (limited to 'lib')
-rw-r--r--lib/AppInfo/Application.php18
-rw-r--r--lib/Listener/LoadSidebarListener.php45
2 files changed, 57 insertions, 6 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index e9daa42a4..af2694eb6 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace OCA\Talk\AppInfo;
+use OCA\Files\Event\LoadSidebar;
use OCA\Talk\Activity\Listener as ActivityListener;
use OCA\Talk\Capabilities;
use OCA\Talk\Chat\Changelog\Listener as ChangelogListener;
@@ -37,14 +38,15 @@ use OCA\Talk\Events\RoomEvent;
use OCA\Talk\Files\Listener as FilesListener;
use OCA\Talk\Files\TemplateLoader as FilesTemplateLoader;
use OCA\Talk\Listener;
+use OCA\Talk\Listener\LoadSidebarListener;
use OCA\Talk\Listener\RestrictStartingCalls as RestrictStartingCallsListener;
use OCA\Talk\Middleware\CanUseTalkMiddleware;
use OCA\Talk\Middleware\InjectionMiddleware;
use OCA\Talk\Notification\Listener as NotificationListener;
use OCA\Talk\Notification\Notifier;
+use OCA\Talk\PublicShare\TemplateLoader as PublicShareTemplateLoader;
use OCA\Talk\PublicShareAuth\Listener as PublicShareAuthListener;
use OCA\Talk\PublicShareAuth\TemplateLoader as PublicShareAuthTemplateLoader;
-use OCA\Talk\PublicShare\TemplateLoader as PublicShareTemplateLoader;
use OCA\Talk\Room;
use OCA\Talk\Settings\Personal;
use OCA\Talk\Share\RoomShareProvider;
@@ -59,10 +61,13 @@ use OCP\Security\CSP\AddContentSecurityPolicyEvent;
use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent;
use OCP\Settings\IManager;
+
class Application extends App {
+ const APP_ID = 'spreed';
+
public function __construct(array $urlParams = []) {
- parent::__construct('spreed', $urlParams);
+ parent::__construct(self::APP_ID, $urlParams);
// This needs to be in the constructor,
// because otherwise the middleware is registered on a wrong object,
@@ -100,6 +105,7 @@ class Application extends App {
$dispatcher->addServiceListener(AddContentSecurityPolicyEvent::class, Listener\CSPListener::class);
$dispatcher->addServiceListener(AddFeaturePolicyEvent::class, Listener\FeaturePolicyListener::class);
+ $dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class);
$this->registerNavigationLink($server);
$this->registerRoomActivityHooks($dispatcher);
@@ -117,7 +123,7 @@ class Application extends App {
$resourceManager = $server->query(IResourceManager::class);
$resourceManager->registerResourceProvider(ConversationProvider::class);
\OC::$server->getEventDispatcher()->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () {
- \OCP\Util::addScript('spreed', 'collections');
+ \OCP\Util::addScript(self::APP_ID, 'collections');
});
}
@@ -135,10 +141,10 @@ class Application extends App {
$config = $server->query(Config::class);
$user = $server->getUserSession()->getUser();
return [
- 'id' => 'spreed',
- 'name' => $server->getL10N('spreed')->t('Talk'),
+ 'id' => self::APP_ID,
+ 'name' => $server->getL10N(self::APP_ID)->t('Talk'),
'href' => $server->getURLGenerator()->linkToRouteAbsolute('spreed.Page.index'),
- 'icon' => $server->getURLGenerator()->imagePath('spreed', 'app.svg'),
+ 'icon' => $server->getURLGenerator()->imagePath(self::APP_ID, 'app.svg'),
'order' => 3,
'type' => $user instanceof IUser && !$config->isDisabledForUser($user) ? 'link' : 'hidden',
];
diff --git a/lib/Listener/LoadSidebarListener.php b/lib/Listener/LoadSidebarListener.php
new file mode 100644
index 000000000..23952fb8a
--- /dev/null
+++ b/lib/Listener/LoadSidebarListener.php
@@ -0,0 +1,45 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author John Molakvoæ (skjnldsv) <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\Talk\Listener;
+
+use OCA\Talk\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, 'files-sidebar-tab');
+ Util::addScript(Application::APP_ID, 'talk-chat-tab');
+ }
+
+}