summaryrefslogtreecommitdiffstats
path: root/apps/comments
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-10-19 09:49:04 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-10-20 14:39:28 +0200
commit3e1916080af3ec2bc2fb7fd64f127cbd0c9b8a76 (patch)
tree7bb108093985d85174604db408992d58195501f6 /apps/comments
parentafa737652247365838832837ae4ce20bca039ad9 (diff)
downloadnextcloud-server-3e1916080af3ec2bc2fb7fd64f127cbd0c9b8a76.tar.gz
nextcloud-server-3e1916080af3ec2bc2fb7fd64f127cbd0c9b8a76.zip
Add ICommentsManager::load method
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/comments')
-rw-r--r--apps/comments/composer/composer/autoload_classmap.php2
-rw-r--r--apps/comments/composer/composer/autoload_static.php2
-rw-r--r--apps/comments/lib/AppInfo/Application.php6
-rw-r--r--apps/comments/lib/Event/LoadCommentsApp.php35
-rw-r--r--apps/comments/lib/Listener/LoadCommentsAppListener.php55
-rw-r--r--apps/comments/lib/Listener/LoadSidebarScripts.php13
-rw-r--r--apps/comments/src/comments.js5
7 files changed, 6 insertions, 112 deletions
diff --git a/apps/comments/composer/composer/autoload_classmap.php b/apps/comments/composer/composer/autoload_classmap.php
index b0485a5c4e3..c4d8a9e331b 100644
--- a/apps/comments/composer/composer/autoload_classmap.php
+++ b/apps/comments/composer/composer/autoload_classmap.php
@@ -15,11 +15,9 @@ return array(
'OCA\\Comments\\Collaboration\\CommentersSorter' => $baseDir . '/../lib/Collaboration/CommentersSorter.php',
'OCA\\Comments\\Controller\\Notifications' => $baseDir . '/../lib/Controller/Notifications.php',
'OCA\\Comments\\EventHandler' => $baseDir . '/../lib/EventHandler.php',
- 'OCA\\Comments\\Event\\LoadCommentsApp' => $baseDir . '/../lib/Event/LoadCommentsApp.php',
'OCA\\Comments\\JSSettingsHelper' => $baseDir . '/../lib/JSSettingsHelper.php',
'OCA\\Comments\\Listener\\CommentsEntityEventListener' => $baseDir . '/../lib/Listener/CommentsEntityEventListener.php',
'OCA\\Comments\\Listener\\LoadAdditionalScripts' => $baseDir . '/../lib/Listener/LoadAdditionalScripts.php',
- 'OCA\\Comments\\Listener\\LoadCommentsAppListener' => $baseDir . '/../lib/Listener/LoadCommentsAppListener.php',
'OCA\\Comments\\Listener\\LoadSidebarScripts' => $baseDir . '/../lib/Listener/LoadSidebarScripts.php',
'OCA\\Comments\\Notification\\Listener' => $baseDir . '/../lib/Notification/Listener.php',
'OCA\\Comments\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
diff --git a/apps/comments/composer/composer/autoload_static.php b/apps/comments/composer/composer/autoload_static.php
index bc69b25743d..72b37969ec0 100644
--- a/apps/comments/composer/composer/autoload_static.php
+++ b/apps/comments/composer/composer/autoload_static.php
@@ -30,11 +30,9 @@ class ComposerStaticInitComments
'OCA\\Comments\\Collaboration\\CommentersSorter' => __DIR__ . '/..' . '/../lib/Collaboration/CommentersSorter.php',
'OCA\\Comments\\Controller\\Notifications' => __DIR__ . '/..' . '/../lib/Controller/Notifications.php',
'OCA\\Comments\\EventHandler' => __DIR__ . '/..' . '/../lib/EventHandler.php',
- 'OCA\\Comments\\Event\\LoadCommentsApp' => __DIR__ . '/..' . '/../lib/Event/LoadCommentsApp.php',
'OCA\\Comments\\JSSettingsHelper' => __DIR__ . '/..' . '/../lib/JSSettingsHelper.php',
'OCA\\Comments\\Listener\\CommentsEntityEventListener' => __DIR__ . '/..' . '/../lib/Listener/CommentsEntityEventListener.php',
'OCA\\Comments\\Listener\\LoadAdditionalScripts' => __DIR__ . '/..' . '/../lib/Listener/LoadAdditionalScripts.php',
- 'OCA\\Comments\\Listener\\LoadCommentsAppListener' => __DIR__ . '/..' . '/../lib/Listener/LoadCommentsAppListener.php',
'OCA\\Comments\\Listener\\LoadSidebarScripts' => __DIR__ . '/..' . '/../lib/Listener/LoadSidebarScripts.php',
'OCA\\Comments\\Notification\\Listener' => __DIR__ . '/..' . '/../lib/Notification/Listener.php',
'OCA\\Comments\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
diff --git a/apps/comments/lib/AppInfo/Application.php b/apps/comments/lib/AppInfo/Application.php
index 0f22cd309ec..4eb097ff001 100644
--- a/apps/comments/lib/AppInfo/Application.php
+++ b/apps/comments/lib/AppInfo/Application.php
@@ -30,8 +30,6 @@ namespace OCA\Comments\AppInfo;
use Closure;
use OCA\Comments\Capabilities;
use OCA\Comments\Controller\Notifications;
-use OCA\Comments\Event\LoadCommentsApp;
-use OCA\Comments\Listener\LoadCommentsAppListener;
use OCA\Comments\EventHandler;
use OCA\Comments\JSSettingsHelper;
use OCA\Comments\Listener\CommentsEntityEventListener;
@@ -73,10 +71,6 @@ class Application extends App implements IBootstrap {
LoadSidebarScripts::class
);
$context->registerEventListener(
- LoadCommentsApp::class,
- LoadCommentsAppListener::class
- );
- $context->registerEventListener(
CommentsEntityEvent::EVENT_ENTITY,
CommentsEntityEventListener::class
);
diff --git a/apps/comments/lib/Event/LoadCommentsApp.php b/apps/comments/lib/Event/LoadCommentsApp.php
deleted file mode 100644
index 74ed93ad447..00000000000
--- a/apps/comments/lib/Event/LoadCommentsApp.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-declare(strict_types=1);
-/**
- * @copyright Copyright (c) 2020, 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\Comments\Event;
-
-use OCP\EventDispatcher\Event;
-
-/**
- * This event is used to load and init the comments app
- *
- * @since 21.0.0
- */
-class LoadCommentsApp extends Event {
-}
diff --git a/apps/comments/lib/Listener/LoadCommentsAppListener.php b/apps/comments/lib/Listener/LoadCommentsAppListener.php
deleted file mode 100644
index 755bdaee1ba..00000000000
--- a/apps/comments/lib/Listener/LoadCommentsAppListener.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright Copyright (c) 2020, 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\Comments\Listener;
-
-use OCA\Comments\AppInfo\Application;
-use OCA\Comments\Event\LoadCommentsApp;
-use OCP\AppFramework\Services\IInitialState;
-use OCP\Comments\IComment;
-use OCP\EventDispatcher\Event;
-use OCP\EventDispatcher\IEventListener;
-use OCP\Util;
-
-class LoadCommentsAppListener implements IEventListener {
-
- /** @var IInitialState */
- private $initialStateService;
-
- public function __construct(IInitialState $initialStateService) {
- $this->initialStateService = $initialStateService;
- }
-
- public function handle(Event $event): void {
- if (!($event instanceof LoadCommentsApp)) {
- return;
- }
-
- $this->initialStateService->provideInitialState('max-message-length', IComment::MAX_MESSAGE_LENGTH);
-
- Util::addScript(Application::APP_ID, 'comments-app');
- }
-}
diff --git a/apps/comments/lib/Listener/LoadSidebarScripts.php b/apps/comments/lib/Listener/LoadSidebarScripts.php
index 0b76d88363d..654482cf57e 100644
--- a/apps/comments/lib/Listener/LoadSidebarScripts.php
+++ b/apps/comments/lib/Listener/LoadSidebarScripts.php
@@ -28,20 +28,19 @@ declare(strict_types=1);
namespace OCA\Comments\Listener;
use OCA\Comments\AppInfo\Application;
-use OCA\Comments\Event\LoadCommentsApp;
use OCA\Files\Event\LoadSidebar;
+use OCP\Comments\ICommentsManager;
use OCP\EventDispatcher\Event;
-use OCP\EventDispatcher\IEventDispatcher;
use OCP\EventDispatcher\IEventListener;
use OCP\Util;
class LoadSidebarScripts implements IEventListener {
- /** @var IEventDispatcher */
- private $eventDispatcher;
+ /** @var ICommentsManager */
+ private $commentsManager;
- public function __construct(IEventDispatcher $eventDispatcher) {
- $this->eventDispatcher = $eventDispatcher;
+ public function __construct(ICommentsManager $commentsManager) {
+ $this->commentsManager = $commentsManager;
}
public function handle(Event $event): void {
@@ -49,7 +48,7 @@ class LoadSidebarScripts implements IEventListener {
return;
}
- $this->eventDispatcher->dispatchTyped(new LoadCommentsApp());
+ $this->commentsManager->load();
// TODO: make sure to only include the sidebar script when
// we properly split it between files list and sidebar
diff --git a/apps/comments/src/comments.js b/apps/comments/src/comments.js
index 547a0af39f5..3d7f52f4e74 100644
--- a/apps/comments/src/comments.js
+++ b/apps/comments/src/comments.js
@@ -3,9 +3,4 @@ import './templates'
import './filesplugin'
import './activitytabviewplugin'
-import './vendor/Caret.js/dist/jquery.caret.min'
-
-import './style/autocomplete.scss'
-import './style/comments.scss'
-
window.OCA.Comments = OCA.Comments