aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-11-06 16:20:38 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-11-07 19:15:18 +0000
commit7e057082cca5adc2fd01c38a99563a083b1ad22f (patch)
treeec164868c9c521d826e88a5525da6645e718bfe7 /apps
parent6b2ea4f0df1bf03fed664931c481151f623eb7e3 (diff)
downloadnextcloud-server-7e057082cca5adc2fd01c38a99563a083b1ad22f.tar.gz
nextcloud-server-7e057082cca5adc2fd01c38a99563a083b1ad22f.zip
fix(theming): Return default theme if the user never selected a themebackport/49112/stable29
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/theming/lib/Service/ThemesService.php4
-rw-r--r--apps/theming/tests/Service/ThemesServiceTest.php20
2 files changed, 12 insertions, 12 deletions
diff --git a/apps/theming/lib/Service/ThemesService.php b/apps/theming/lib/Service/ThemesService.php
index d080752a032..8244e69e219 100644
--- a/apps/theming/lib/Service/ThemesService.php
+++ b/apps/theming/lib/Service/ThemesService.php
@@ -143,7 +143,7 @@ class ThemesService {
$this->setEnabledThemes($enabledThemes);
return $enabledThemes;
}
-
+
return $themesIds;
}
@@ -176,7 +176,7 @@ class ThemesService {
}
$enforcedTheme = $this->config->getSystemValueString('enforce_theme', '');
- $enabledThemes = json_decode($this->config->getUserValue($user->getUID(), Application::APP_ID, 'enabled-themes', '[]'));
+ $enabledThemes = json_decode($this->config->getUserValue($user->getUID(), Application::APP_ID, 'enabled-themes', '["default"]'));
if ($enforcedTheme !== '') {
return array_merge([$enforcedTheme], $enabledThemes);
}
diff --git a/apps/theming/tests/Service/ThemesServiceTest.php b/apps/theming/tests/Service/ThemesServiceTest.php
index 4728a2cf64e..1b152b00721 100644
--- a/apps/theming/tests/Service/ThemesServiceTest.php
+++ b/apps/theming/tests/Service/ThemesServiceTest.php
@@ -138,8 +138,8 @@ class ThemesServiceTest extends TestCase {
public function dataTestEnableTheme() {
return [
- ['default', [], ['default']],
- ['dark', [], ['dark']],
+ ['default', ['default'], ['default']],
+ ['dark', ['default'], ['dark']],
['dark', ['dark'], ['dark']],
['opendyslexic', ['dark'], ['dark', 'opendyslexic']],
['dark', ['light-highcontrast', 'opendyslexic'], ['opendyslexic', 'dark']],
@@ -164,7 +164,7 @@ class ThemesServiceTest extends TestCase {
$this->config->expects($this->once())
->method('getUserValue')
- ->with('user', Application::APP_ID, 'enabled-themes', '[]')
+ ->with('user', Application::APP_ID, 'enabled-themes', '["default"]')
->willReturn(json_encode($enabledThemes));
$this->assertEquals($expectedEnabled, $this->themesService->enableTheme($this->themes[$toEnable]));
@@ -173,7 +173,7 @@ class ThemesServiceTest extends TestCase {
public function dataTestDisableTheme() {
return [
- ['dark', [], []],
+ ['dark', ['default'], ['default']],
['dark', ['dark'], []],
['opendyslexic', ['dark', 'opendyslexic'], ['dark'], ],
['light-highcontrast', ['opendyslexic'], ['opendyslexic']],
@@ -198,7 +198,7 @@ class ThemesServiceTest extends TestCase {
$this->config->expects($this->once())
->method('getUserValue')
- ->with('user', Application::APP_ID, 'enabled-themes', '[]')
+ ->with('user', Application::APP_ID, 'enabled-themes', '["default"]')
->willReturn(json_encode($enabledThemes));
@@ -232,7 +232,7 @@ class ThemesServiceTest extends TestCase {
$this->config->expects($this->once())
->method('getUserValue')
- ->with('user', Application::APP_ID, 'enabled-themes', '[]')
+ ->with('user', Application::APP_ID, 'enabled-themes', '["default"]')
->willReturn(json_encode($enabledThemes));
@@ -251,14 +251,14 @@ class ThemesServiceTest extends TestCase {
$this->config->expects($this->once())
->method('getUserValue')
- ->with('user', Application::APP_ID, 'enabled-themes', '[]')
- ->willReturn(json_encode([]));
+ ->with('user', Application::APP_ID, 'enabled-themes', '["default"]')
+ ->willReturn(json_encode(['default']));
$this->config->expects($this->once())
->method('getSystemValueString')
->with('enforce_theme', '')
->willReturn('');
- $this->assertEquals([], $this->themesService->getEnabledThemes());
+ $this->assertEquals(['default'], $this->themesService->getEnabledThemes());
}
public function testGetEnabledThemesEnforced() {
@@ -273,7 +273,7 @@ class ThemesServiceTest extends TestCase {
$this->config->expects($this->once())
->method('getUserValue')
- ->with('user', Application::APP_ID, 'enabled-themes', '[]')
+ ->with('user', Application::APP_ID, 'enabled-themes', '["default"]')
->willReturn(json_encode([]));
$this->config->expects($this->once())
->method('getSystemValueString')