From 48a13be4dad44ef6a3f0321ec134fefb967f33ba Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 11 Sep 2024 11:26:59 +0200 Subject: fix: `user:settings` command when user is not available If `ignore-missing-user` all sub commands work, except listing all settings for a user like `occ user:settings --ignore-missing-user user core`. Signed-off-by: Ferdinand Thiessen --- core/Command/User/Setting.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/Command') diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php index e2e65f7d5f9..16e851d8252 100644 --- a/core/Command/User/Setting.php +++ b/core/Command/User/Setting.php @@ -219,7 +219,7 @@ class Setting extends Base { } } - protected function getUserSettings($uid, $app) { + protected function getUserSettings(string $uid, string $app): array { $settings = $this->config->getAllUserValues($uid); if ($app !== '') { if (isset($settings[$app])) { @@ -230,7 +230,10 @@ class Setting extends Base { } $user = $this->userManager->get($uid); - $settings['settings']['display_name'] = $user->getDisplayName(); + if ($user !== null) { + // Only add the display name if the user exists + $settings['settings']['display_name'] = $user->getDisplayName(); + } return $settings; } -- cgit v1.2.3