Read apporder from configuration value

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2023-09-25 15:02:23 +02:00
parent bbfa9d1440
commit ac19ba9c66
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A

View file

@ -285,11 +285,15 @@ class NavigationManager implements INavigationManager {
}
if ($this->userSession->isLoggedIn()) {
$apps = $this->appManager->getEnabledAppsForUser($this->userSession->getUser());
$user = $this->userSession->getUser();
$apps = $this->appManager->getEnabledAppsForUser($user);
$customOrders = json_decode($this->config->getUserValue($user->getUID(), 'core', 'apporder', '[]'), true, flags:JSON_THROW_ON_ERROR);
} else {
$apps = $this->appManager->getInstalledApps();
$customOrders = [];
}
foreach ($apps as $app) {
if (!$this->userSession->isLoggedIn() && !$this->appManager->isEnabledForUser($app, $this->userSession->getUser())) {
continue;
@ -315,7 +319,7 @@ class NavigationManager implements INavigationManager {
}
$l = $this->l10nFac->get($app);
$id = $nav['id'] ?? $app . ($key === 0 ? '' : $key);
$order = isset($nav['order']) ? $nav['order'] : 100;
$order = $customOrders[$app][$key] ?? $nav['order'] ?? 100;
$type = $nav['type'];
$route = !empty($nav['route']) ? $this->urlGenerator->linkToRoute($nav['route']) : '';
$icon = isset($nav['icon']) ? $nav['icon'] : 'app.svg';