Skip to content

Commit

Permalink
Merge pull request #48452 from nextcloud/backport/48439/stable30
Browse files Browse the repository at this point in the history
[stable30] fix(theming): Use `AppConfig` for setting background image
  • Loading branch information
susnux authored Oct 2, 2024
2 parents fcf45b6 + 7ca6e45 commit b764ad7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/theming/lib/Service/BackgroundService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -200,6 +201,7 @@ class BackgroundService {
public function __construct(
private IRootFolder $rootFolder,
private IAppData $appData,
private IAppConfig $appConfig,
private IConfig $config,
private ?string $userId,
) {
Expand Down Expand Up @@ -328,7 +330,7 @@ public function setGlobalBackground($path): string|null {
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;
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,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'),
);
Expand Down

0 comments on commit b764ad7

Please sign in to comment.