diff --git a/apps/files_reminders/appinfo/info.xml b/apps/files_reminders/appinfo/info.xml index 83e1e813cce..86cee2e7f5b 100644 --- a/apps/files_reminders/appinfo/info.xml +++ b/apps/files_reminders/appinfo/info.xml @@ -13,10 +13,6 @@ Set file reminders. Christopher Ng FilesReminders - - - - files https://github.com/nextcloud/server/issues @@ -33,10 +29,4 @@ Set file reminders. OCA\FilesReminders\Command\ListCommand - - - - OCA\FilesReminders\Dav\PropFindPlugin - - diff --git a/apps/files_reminders/composer/composer/autoload_classmap.php b/apps/files_reminders/composer/composer/autoload_classmap.php index 7dc5063c182..8d6284d3b5f 100644 --- a/apps/files_reminders/composer/composer/autoload_classmap.php +++ b/apps/files_reminders/composer/composer/autoload_classmap.php @@ -19,6 +19,7 @@ return array( 'OCA\\FilesReminders\\Exception\\UserNotFoundException' => $baseDir . '/../lib/Exception/UserNotFoundException.php', 'OCA\\FilesReminders\\Listener\\LoadAdditionalScriptsListener' => $baseDir . '/../lib/Listener/LoadAdditionalScriptsListener.php', 'OCA\\FilesReminders\\Listener\\NodeDeletedListener' => $baseDir . '/../lib/Listener/NodeDeletedListener.php', + 'OCA\\FilesReminders\\Listener\\SabrePluginAddListener' => $baseDir . '/../lib/Listener/SabrePluginAddListener.php', 'OCA\\FilesReminders\\Listener\\UserDeletedListener' => $baseDir . '/../lib/Listener/UserDeletedListener.php', 'OCA\\FilesReminders\\Migration\\Version10000Date20230725162149' => $baseDir . '/../lib/Migration/Version10000Date20230725162149.php', 'OCA\\FilesReminders\\Model\\RichReminder' => $baseDir . '/../lib/Model/RichReminder.php', diff --git a/apps/files_reminders/composer/composer/autoload_static.php b/apps/files_reminders/composer/composer/autoload_static.php index 7c14a9da02c..f1d8b8c8d0b 100644 --- a/apps/files_reminders/composer/composer/autoload_static.php +++ b/apps/files_reminders/composer/composer/autoload_static.php @@ -34,6 +34,7 @@ class ComposerStaticInitFilesReminders 'OCA\\FilesReminders\\Exception\\UserNotFoundException' => __DIR__ . '/..' . '/../lib/Exception/UserNotFoundException.php', 'OCA\\FilesReminders\\Listener\\LoadAdditionalScriptsListener' => __DIR__ . '/..' . '/../lib/Listener/LoadAdditionalScriptsListener.php', 'OCA\\FilesReminders\\Listener\\NodeDeletedListener' => __DIR__ . '/..' . '/../lib/Listener/NodeDeletedListener.php', + 'OCA\\FilesReminders\\Listener\\SabrePluginAddListener' => __DIR__ . '/..' . '/../lib/Listener/SabrePluginAddListener.php', 'OCA\\FilesReminders\\Listener\\UserDeletedListener' => __DIR__ . '/..' . '/../lib/Listener/UserDeletedListener.php', 'OCA\\FilesReminders\\Migration\\Version10000Date20230725162149' => __DIR__ . '/..' . '/../lib/Migration/Version10000Date20230725162149.php', 'OCA\\FilesReminders\\Model\\RichReminder' => __DIR__ . '/..' . '/../lib/Model/RichReminder.php', diff --git a/apps/files_reminders/lib/AppInfo/Application.php b/apps/files_reminders/lib/AppInfo/Application.php index 56b0c97a7a2..7adeefc3503 100644 --- a/apps/files_reminders/lib/AppInfo/Application.php +++ b/apps/files_reminders/lib/AppInfo/Application.php @@ -26,9 +26,11 @@ declare(strict_types=1); namespace OCA\FilesReminders\AppInfo; +use OCA\DAV\Events\SabrePluginAddEvent; use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCA\FilesReminders\Listener\LoadAdditionalScriptsListener; use OCA\FilesReminders\Listener\NodeDeletedListener; +use OCA\FilesReminders\Listener\SabrePluginAddListener; use OCA\FilesReminders\Listener\UserDeletedListener; use OCA\FilesReminders\Notification\Notifier; use OCP\AppFramework\App; @@ -51,6 +53,8 @@ class Application extends App implements IBootstrap { public function register(IRegistrationContext $context): void { $context->registerNotifierService(Notifier::class); + $context->registerEventListener(SabrePluginAddEvent::class, SabrePluginAddListener::class); + $context->registerEventListener(NodeDeletedEvent::class, NodeDeletedListener::class); $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); diff --git a/apps/files_reminders/lib/Listener/SabrePluginAddListener.php b/apps/files_reminders/lib/Listener/SabrePluginAddListener.php new file mode 100644 index 00000000000..afb91716443 --- /dev/null +++ b/apps/files_reminders/lib/Listener/SabrePluginAddListener.php @@ -0,0 +1,51 @@ + + * + * @author Christopher Ng + * + * @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\FilesReminders\Listener; + +use OCA\DAV\Events\SabrePluginAddEvent; +use OCA\FilesReminders\Dav\PropFindPlugin; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; +use Psr\Container\ContainerInterface; + +/** @template-implements IEventListener */ +class SabrePluginAddListener implements IEventListener { + public function __construct( + private ContainerInterface $container, + ) { + } + + public function handle(Event $event): void { + if (!($event instanceof SabrePluginAddEvent)) { + return; + } + + $server = $event->getServer(); + $plugin = $this->container->get(PropFindPlugin::class); + $server->addPlugin($plugin); + } +}