diff options
author | provokateurin <kate@provokateurin.de> | 2024-11-06 16:20:38 +0100 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-11-06 16:20:38 +0100 |
commit | 7cb295fcf46b7a42939ce178f5f7e409a855645b (patch) | |
tree | a559b4a952a65f5a6646dce528ed0c148dfc9c72 /apps | |
parent | 9276f453ae7046ae42a97415378af813f4e718b0 (diff) | |
download | nextcloud-server-7cb295fcf46b7a42939ce178f5f7e409a855645b.tar.gz nextcloud-server-7cb295fcf46b7a42939ce178f5f7e409a855645b.zip |
fix(theming): Return default theme if the user never selected a themefix/theming/default-theme-selection
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/theming/lib/Service/ThemesService.php | 4 | ||||
-rw-r--r-- | apps/theming/tests/Service/ThemesServiceTest.php | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/apps/theming/lib/Service/ThemesService.php b/apps/theming/lib/Service/ThemesService.php index ef8d1ff44ff..433555c980c 100644 --- a/apps/theming/lib/Service/ThemesService.php +++ b/apps/theming/lib/Service/ThemesService.php @@ -127,7 +127,7 @@ class ThemesService { $this->setEnabledThemes($enabledThemes); return $enabledThemes; } - + return $themesIds; } @@ -160,7 +160,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 77371cfe34c..1b242c956e4 100644 --- a/apps/theming/tests/Service/ThemesServiceTest.php +++ b/apps/theming/tests/Service/ThemesServiceTest.php @@ -121,8 +121,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']], @@ -147,7 +147,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])); @@ -156,7 +156,7 @@ class ThemesServiceTest extends TestCase { public function dataTestDisableTheme() { return [ - ['dark', [], []], + ['dark', ['default'], ['default']], ['dark', ['dark'], []], ['opendyslexic', ['dark', 'opendyslexic'], ['dark'], ], ['light-highcontrast', ['opendyslexic'], ['opendyslexic']], @@ -181,7 +181,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)); @@ -215,7 +215,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)); @@ -234,14 +234,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(): void { @@ -256,7 +256,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') |