From 60083b1b5f30a2c1b0e59d3eeac7dd869c86c034 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 28 Sep 2024 22:44:03 +0200 Subject: [PATCH] fix(theming): Use `AppConfig` for setting background image Signed-off-by: Ferdinand Thiessen --- apps/theming/lib/Service/BackgroundService.php | 4 +++- lib/private/Server.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/theming/lib/Service/BackgroundService.php b/apps/theming/lib/Service/BackgroundService.php index bf6508744487c..d403e77635c11 100644 --- a/apps/theming/lib/Service/BackgroundService.php +++ b/apps/theming/lib/Service/BackgroundService.php @@ -18,6 +18,7 @@ use OCP\Files\NotPermittedException; use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; +use OCP\IAppConfig; use OCP\IConfig; use OCP\Lock\LockedException; use OCP\PreConditionNotMetException; @@ -200,6 +201,7 @@ class BackgroundService { public function __construct( private IRootFolder $rootFolder, private IAppData $appData, + private IAppConfig $appConfig, private IConfig $config, private ?string $userId, ) { @@ -328,7 +330,7 @@ public function setGlobalBackground($path): ?string { if ($handle && $image->loadFromFileHandle($handle) !== false) { $meanColor = $this->calculateMeanColor($image); if ($meanColor !== false) { - $this->config->setAppValue(Application::APP_ID, 'background_color', $meanColor); + $this->appConfig->setValueString(Application::APP_ID, 'background_color', $meanColor); return $meanColor; } } diff --git a/lib/private/Server.php b/lib/private/Server.php index 19c3b72c11c4a..2faae765960ef 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -1041,6 +1041,7 @@ public function __construct($webRoot, \OC\Config $config) { $backgroundService = new BackgroundService( $c->get(IRootFolder::class), $c->getAppDataDir('theming'), + $c->get(IAppConfig::class), $c->get(\OCP\IConfig::class), $c->get(ISession::class)->get('user_id'), );