]> source.dussan.org Git - nextcloud-server.git/commitdiff
enh(NavigationManager): Use ID as fallback for `app` property of entries 42055/head
authorFerdinand Thiessen <opensource@fthiessen.de>
Wed, 6 Dec 2023 13:39:33 +0000 (14:39 +0100)
committerFerdinand Thiessen <opensource@fthiessen.de>
Wed, 6 Dec 2023 14:46:22 +0000 (15:46 +0100)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
lib/private/NavigationManager.php

index 27963b8a45d9136020a3340d4742e1d1e549e9b7..17573d9db86da024b3739a534164021c1e1681f5 100644 (file)
@@ -95,7 +95,10 @@ class NavigationManager implements INavigationManager {
                        return;
                }
 
+               $id = $entry['id'];
+
                $entry['active'] = false;
+               $entry['unread'] = $this->unreadCounters[$id] ?? 0;
                if (!isset($entry['icon'])) {
                        $entry['icon'] = '';
                }
@@ -106,9 +109,12 @@ class NavigationManager implements INavigationManager {
                        $entry['type'] = 'link';
                }
 
-               $id = $entry['id'];
-               $entry['unread'] = $this->unreadCounters[$id] ?? 0;
                if ($entry['type'] === 'link') {
+                       // app might not be set when using closures, in this case try to fallback to ID
+                       if (!isset($entry['app']) && $this->appManager->isEnabledForUser($id)) {
+                               $entry['app'] = $id;
+                       }
+
                        // This is the default app that will always be shown first
                        $entry['default'] = ($entry['app'] ?? false) === $this->defaultApp;
                        // Set order from user defined app order