]> source.dussan.org Git - nextcloud-server.git/commitdiff
move "aways loaded" sharing script to event listener
authorRobin Appelman <robin@icewind.nl>
Mon, 14 Aug 2023 15:46:43 +0000 (17:46 +0200)
committerRobin Appelman <robin@icewind.nl>
Thu, 17 Aug 2023 08:57:56 +0000 (10:57 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/AppInfo/Application.php

index d89419b8ea93622962a30db8801bb4b64322591a..b76239dc00d19c2f7994b2a73b403f9cf14917b6 100644 (file)
@@ -116,11 +116,6 @@ class Application extends App implements IBootstrap {
 
                Share::registerBackend('file', File::class);
                Share::registerBackend('folder', Folder::class, 'file');
-
-               /**
-                * Always add main sharing script
-                */
-               Util::addScript(self::APP_ID, 'main');
        }
 
 
@@ -139,6 +134,12 @@ class Application extends App implements IBootstrap {
                $dispatcher->addListener(ResourcesLoadAdditionalScriptsEvent::class, function () {
                        \OCP\Util::addScript('files_sharing', 'collaboration');
                });
+               $dispatcher->addListener(\OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent::class, function () {
+                       /**
+                        * Always add main sharing script
+                        */
+                       Util::addScript(self::APP_ID, 'main');
+               });
 
                // notifications api to accept incoming user shares
                $dispatcher->addListener(ShareCreatedEvent::class, function (ShareCreatedEvent $event) {