mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Fix default primary for user theming
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
e76715a469
commit
c007a3a670
2 changed files with 10 additions and 10 deletions
|
|
@ -231,10 +231,10 @@ class ThemingDefaults extends \OC_Defaults {
|
|||
$themingBackground = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background', '');
|
||||
// If the user selected the default background
|
||||
if ($themingBackground === '') {
|
||||
return BackgroundService::DEFAULT_COLOR;
|
||||
return $defaultColor;
|
||||
}
|
||||
|
||||
// If the user selected a specific colour
|
||||
// If the user selected a valid custom colour
|
||||
if (preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $themingBackground)) {
|
||||
return $themingBackground;
|
||||
}
|
||||
|
|
@ -245,11 +245,6 @@ class ThemingDefaults extends \OC_Defaults {
|
|||
}
|
||||
}
|
||||
|
||||
// If the default color is not valid, return the default background one
|
||||
if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $defaultColor)) {
|
||||
return BackgroundService::DEFAULT_COLOR;
|
||||
}
|
||||
|
||||
// Finally, return the system global primary color
|
||||
return $defaultColor;
|
||||
}
|
||||
|
|
@ -259,9 +254,12 @@ class ThemingDefaults extends \OC_Defaults {
|
|||
*/
|
||||
public function getDefaultColorPrimary(): string {
|
||||
$color = $this->config->getAppValue(Application::APP_ID, 'color');
|
||||
|
||||
// If the color is invalid, fallback to default
|
||||
if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $color)) {
|
||||
$color = '#0082c9';
|
||||
$color = BackgroundService::DEFAULT_COLOR;
|
||||
}
|
||||
|
||||
return $color;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ Feature: app-theming
|
|||
And I see that the non-plain background color variable is eventually "#0082c9"
|
||||
When I set the "Color" parameter in the Theming app to "#C9C9C9"
|
||||
Then I see that the parameters in the Theming app are eventually saved
|
||||
And I see that the primary color is eventually "#006aa3"
|
||||
# Default user background follows admin theming
|
||||
And I see that the primary color is eventually "#C9C9C9"
|
||||
And I see that the non-plain background color variable is eventually "#C9C9C9"
|
||||
|
||||
Scenario: resetting the color updates the primary color
|
||||
|
|
@ -27,5 +28,6 @@ Feature: app-theming
|
|||
And I see that the non-plain background color variable is eventually "#C9C9C9"
|
||||
When I reset the "Color" parameter in the Theming app to its default value
|
||||
Then I see that the parameters in the Theming app are eventually saved
|
||||
And I see that the primary color is eventually "#006aa3"
|
||||
# Default user background follows admin theming
|
||||
And I see that the primary color is eventually "#0082c9"
|
||||
And I see that the non-plain background color variable is eventually "#0082c9"
|
||||
|
|
|
|||
Loading…
Reference in a new issue