mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Default to first application if no default app is set
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
6083d32a80
commit
a4a3d94f05
1 changed files with 14 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue