]> source.dussan.org Git - nextcloud-server.git/commitdiff
don't always add core/common and core/main during "sorting"
authorRobin Appelman <robin@icewind.nl>
Tue, 15 Aug 2023 10:11:08 +0000 (12:11 +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>
core/Listener/BeforeTemplateRenderedListener.php
lib/public/Util.php

index c453d010a4c5b527f49fb4591c075ac2e6886244..95adfc61ad95916ba3227193ed4531ae3d51f91a 100644 (file)
@@ -49,6 +49,12 @@ class BeforeTemplateRenderedListener implements IEventListener {
 
                \OC_Util::addStyle('server', null, true);
 
+               if ($event instanceof BeforeLoginTemplateRenderedEvent) {
+                       // todo: make login work without these
+                       Util::addScript('core', 'common');
+                       Util::addScript('core', 'main');
+               }
+
                if ($event instanceof BeforeTemplateRenderedEvent) {
                        // include common nextcloud webpack bundle
                        Util::addScript('core', 'common');
index 63ed9e835c77059b8b98479a62f289f0884e2358..1d03c35a9b7a9e797b9bfc00ac150e6c8f288b07 100644 (file)
@@ -212,7 +212,12 @@ class Util {
                $sortedScripts = $sortedScripts ? array_merge(...array_values(($sortedScripts))) : [];
 
                // Override core-common and core-main order
-               array_unshift($sortedScripts, 'core/js/common', 'core/js/main');
+               if (in_array('core/js/main', $sortedScripts)) {
+                       array_unshift($sortedScripts, 'core/js/main');
+               }
+               if (in_array('core/js/common', $sortedScripts)) {
+                       array_unshift($sortedScripts, 'core/js/common');
+               }
 
                return array_unique($sortedScripts);
        }