From a0597da460f10245c3081dc263857bb575eaeda0 Mon Sep 17 00:00:00 2001 From: John Molakvoæ Date: Thu, 27 Apr 2023 11:15:48 +0200 Subject: feat(files): sort favorites first MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/files/lib/Service/UserConfig.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apps/files/lib') diff --git a/apps/files/lib/Service/UserConfig.php b/apps/files/lib/Service/UserConfig.php index e405b02c07a..c39719ae8ed 100644 --- a/apps/files/lib/Service/UserConfig.php +++ b/apps/files/lib/Service/UserConfig.php @@ -41,6 +41,12 @@ class UserConfig { 'default' => false, 'allowed' => [true, false], ], + [ + // Whether to sort favorites first in the list or not + 'key' => 'sort_favorites_first', + 'default' => true, + 'allowed' => [true, false], + ], ]; protected IConfig $config; @@ -133,7 +139,7 @@ class UserConfig { $userConfigs = array_map(function(string $key) use ($userId) { $value = $this->config->getUserValue($userId, Application::APP_ID, $key, $this->getDefaultConfigValue($key)); // If the default is expected to be a boolean, we need to cast the value - if (is_bool($this->getDefaultConfigValue($key))) { + if (is_bool($this->getDefaultConfigValue($key)) && is_string($value)) { return $value === '1'; } return $value; -- cgit v1.2.3