diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-09-26 14:40:14 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-09-26 14:40:14 +0200 |
commit | a4a3d94f058864d188e4daaa300f834ba3cba380 (patch) | |
tree | bcd61f53cc0d5a0663103ff675036767d8a06526 /lib/private/App | |
parent | 6083d32a805d90b5a3bc83577ab81c946b8dd40c (diff) | |
download | nextcloud-server-a4a3d94f058864d188e4daaa300f834ba3cba380.tar.gz nextcloud-server-a4a3d94f058864d188e4daaa300f834ba3cba380.zip |
Default to first application if no default app is set
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/App')
-rw-r--r-- | lib/private/App/AppManager.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 88044fbf7b6..9d07000c6f8 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -825,13 +825,26 @@ class AppManager implements IAppManager { public function getDefaultAppForUser(?IUser $user = null): string { // Set fallback to always-enabled files app $appId = 'files'; - $defaultApps = explode(',', $this->config->getSystemValueString('defaultapp', 'dashboard,files')); + $defaultApps = explode(',', $this->config->getSystemValueString('defaultapp', '')); $user ??= $this->userSession->getUser(); if ($user !== null) { $userDefaultApps = explode(',', $this->config->getUserValue($user->getUID(), 'core', 'defaultapp')); $defaultApps = array_filter(array_merge($userDefaultApps, $defaultApps)); + if (empty($defaultApps)) { + /* Fallback on user defined apporder */ + $customOrders = json_decode($this->config->getUserValue($user->getUID(), 'core', 'apporder', '[]'), true, flags:JSON_THROW_ON_ERROR); + if (!empty($customOrders)) { + $customOrders = array_map('min', $customOrders); + asort($customOrders); + $defaultApps = array_keys($customOrders); + } + } + } + + if (empty($defaultApps)) { + $defaultApps = ['dashboard','files']; } // Find the first app that is enabled for the current user |