diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-11-29 09:51:34 +0100 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2022-11-29 11:26:27 +0100 |
commit | a869259e411486486fb1206dfa74f5363834d92f (patch) | |
tree | 7ea353549158dc5898d917452f8b9c6970438c87 /apps/theming/lib | |
parent | 064fa10ecfe4725398895a21ab8bafd171e2eadd (diff) | |
download | nextcloud-server-a869259e411486486fb1206dfa74f5363834d92f.tar.gz nextcloud-server-a869259e411486486fb1206dfa74f5363834d92f.zip |
More theming cypress tests and some fixes
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r-- | apps/theming/lib/ImageManager.php | 2 | ||||
-rw-r--r-- | apps/theming/lib/Jobs/MigrateBackgroundImages.php | 1 | ||||
-rw-r--r-- | apps/theming/lib/Listener/BeforeTemplateRenderedListener.php | 4 | ||||
-rw-r--r-- | apps/theming/lib/Service/BackgroundService.php | 2 | ||||
-rw-r--r-- | apps/theming/lib/Themes/CommonThemeTrait.php | 7 | ||||
-rw-r--r-- | apps/theming/lib/ThemingDefaults.php | 6 |
6 files changed, 9 insertions, 13 deletions
diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php index d4f4353b8a8..f7b0c12844a 100644 --- a/apps/theming/lib/ImageManager.php +++ b/apps/theming/lib/ImageManager.php @@ -94,7 +94,7 @@ class ImageManager { case 'favicon': return $this->urlGenerator->imagePath('core', 'logo/logo.png') . '?v=' . $cacheBusterCounter; case 'background': - return $this->urlGenerator->linkTo(Application::APP_ID, 'img/background/' . BackgroundService::DEFAULT_BACKGROUND); + return $this->urlGenerator->linkTo(Application::APP_ID, 'img/background/' . BackgroundService::DEFAULT_BACKGROUND_IMAGE); } return ''; } diff --git a/apps/theming/lib/Jobs/MigrateBackgroundImages.php b/apps/theming/lib/Jobs/MigrateBackgroundImages.php index 4b0cf187bae..54c0d591e40 100644 --- a/apps/theming/lib/Jobs/MigrateBackgroundImages.php +++ b/apps/theming/lib/Jobs/MigrateBackgroundImages.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCA\Theming\Jobs; use OCA\Theming\AppInfo\Application; -use OCP\App\IAppManager; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\QueuedJob; diff --git a/apps/theming/lib/Listener/BeforeTemplateRenderedListener.php b/apps/theming/lib/Listener/BeforeTemplateRenderedListener.php index d0fa9690602..380527ee024 100644 --- a/apps/theming/lib/Listener/BeforeTemplateRenderedListener.php +++ b/apps/theming/lib/Listener/BeforeTemplateRenderedListener.php @@ -93,7 +93,7 @@ class BeforeTemplateRenderedListener implements IEventListener { /** User color */ $this->initialState->provideInitialState( 'backgroundColor', - $this->config->getUserValue($userId, Application::APP_ID, 'background_image', BackgroundService::BACKGROUND_DEFAULT), + $this->config->getUserValue($userId, Application::APP_ID, 'background_color', BackgroundService::DEFAULT_COLOR), ); /** @@ -106,7 +106,7 @@ class BeforeTemplateRenderedListener implements IEventListener { ); $this->initialState->provideInitialState( 'defaultShippedBackground', - BackgroundService::DEFAULT_BACKGROUND, + BackgroundService::DEFAULT_BACKGROUND_IMAGE, ); /** List of all shipped backgrounds */ diff --git a/apps/theming/lib/Service/BackgroundService.php b/apps/theming/lib/Service/BackgroundService.php index 002ca169a83..a3af56b08f8 100644 --- a/apps/theming/lib/Service/BackgroundService.php +++ b/apps/theming/lib/Service/BackgroundService.php @@ -53,7 +53,7 @@ class BackgroundService { public const BACKGROUND_DEFAULT = 'default'; public const BACKGROUND_DISABLED = 'disabled'; - public const DEFAULT_BACKGROUND = 'kamil-porembinski-clouds.jpg'; + public const DEFAULT_BACKGROUND_IMAGE = 'kamil-porembinski-clouds.jpg'; public const SHIPPED_BACKGROUNDS = [ 'anatoly-mikhaltsov-butterfly-wing-scale.jpg' => [ 'attribution' => 'Butterfly wing scale (Anatoly Mikhaltsov, CC BY-SA)', diff --git a/apps/theming/lib/Themes/CommonThemeTrait.php b/apps/theming/lib/Themes/CommonThemeTrait.php index 40feddd2b38..18d3fb2d814 100644 --- a/apps/theming/lib/Themes/CommonThemeTrait.php +++ b/apps/theming/lib/Themes/CommonThemeTrait.php @@ -89,16 +89,14 @@ trait CommonThemeTrait { $variables = []; // Default last fallback values - $variables['--image-background-default'] = $backgroundDeleted ?: "url('" . $this->themingDefaults->getBackground() . "')"; + $variables['--image-background-default'] = "url('" . $this->themingDefaults->getBackground() . "')"; $variables['--color-background-plain'] = $this->defaultPrimaryColor; // If primary as background has been request or if we have a custom primary colour // let's not define the background image if ($backgroundDeleted) { $variables['--color-background-plain'] = $this->themingDefaults->getColorPrimary(); - if ($this->themingDefaults->isUserThemingDisabled() || $user === null) { - $variables['--image-background-plain'] = 'yes'; - } + $variables['--image-background-plain'] = 'yes'; } // Register image variables only if custom-defined @@ -111,7 +109,6 @@ trait CommonThemeTrait { continue; } $variables['--image-background-size'] = 'cover'; - $variables['--image-background-default'] = "url('" . $imageUrl . "')"; } // --image-background is overridden by user theming $variables["--image-$image"] = "url('" . $imageUrl . "')"; diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 954b1be651b..881a27f9936 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -227,10 +227,10 @@ class ThemingDefaults extends \OC_Defaults { // user-defined primary color if (!empty($user)) { - $themingBackground = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background_color', ''); + $themingBackgroundColor = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background_color', ''); // If the user selected a specific colour - if (preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $themingBackground)) { - return $themingBackground; + if (preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $themingBackgroundColor)) { + return $themingBackgroundColor; } } |