aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/App/AppManager.php
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2023-11-09 16:41:21 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2023-11-14 20:04:48 +0100
commit927e7fcf67e4e1216e1551160919cd018f12b963 (patch)
treeaaa1e1ddda2919a26986fc7495730aa160b1ca00 /lib/private/App/AppManager.php
parent54a3012a111a5370a7e072d8ab5ff54c5707af60 (diff)
downloadnextcloud-server-927e7fcf67e4e1216e1551160919cd018f12b963.tar.gz
nextcloud-server-927e7fcf67e4e1216e1551160919cd018f12b963.zip
fix(AppManager): Ensure that app manager can handle empty app keys on the navigation entries
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private/App/AppManager.php')
-rw-r--r--lib/private/App/AppManager.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index a7ab22dfc66..84bc297143a 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -838,10 +838,12 @@ class AppManager implements IAppManager {
/* Fallback on user defined apporder */
$customOrders = json_decode($this->config->getUserValue($user->getUID(), 'core', 'apporder', '[]'), true, flags:JSON_THROW_ON_ERROR);
if (!empty($customOrders)) {
- uasort($customOrders, function ($a, $b) {
- return $a['order'] - $b['order'];
- });
- $defaultApps = array_keys($customOrders);
+ // filter only entries with app key (when added using closures or NavigationManager::add the app is not guranteed to be set)
+ $customOrders = array_filter($customOrders, fn ($entry) => isset($entry['app']));
+ // sort apps by order
+ usort($customOrders, fn ($a, $b) => $a['order'] - $b['order']);
+ // set default apps to sorted apps
+ $defaultApps = array_map(fn ($entry) => $entry['app'], $customOrders);
}
}
}