Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl committed Sep 2, 2024
1 parent e510535 commit f71bb7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/private/AllConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ public function getUserValue($userId, $appName, $key, $default = '') {
if ($userId === null || $userId === '') {
return $default;
}
return \OC::$server->get(UserPreferences::class)->getValueMixed($userId, $appName, $key, $default);
$userPrefs = \OC::$server->get(UserPreferences::class);
// because $default can be null ...
if (!$userPrefs->hasKey($userId, $appName, $key)) {
return $default;
}
return \OC::$server->get(UserPreferences::class)->getValueMixed($userId, $appName, $key, $default ?? '');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/private/UserPreferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public function getValueMixed(
string $key,
string $default = '',
?bool $lazy = false
): ?string {
): string {
try {
$lazy = ($lazy === null) ? $this->isLazy($userId, $app, $key) : $lazy;
} catch (UnknownKeyException) {
Expand All @@ -465,7 +465,7 @@ public function getValueMixed(
$userId,
$app,
$key,
$default ?? '',
$default,
$lazy,
ValueType::MIXED
);
Expand Down

0 comments on commit f71bb7d

Please sign in to comment.