Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/theming/lib/Service/ThemesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function disableTheme(ITheme $theme): array {
$this->setEnabledThemes($enabledThemes);
return $enabledThemes;
}

return $themesIds;
}

Expand Down Expand Up @@ -160,7 +160,7 @@ public function getEnabledThemes(): array {
}

$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);
}
Expand Down
20 changes: 10 additions & 10 deletions apps/theming/tests/Service/ThemesServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public function testGetThemesEnforcedInvalid(): void {

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']],
Expand All @@ -147,7 +147,7 @@ public function testEnableTheme(string $toEnable, array $enabledThemes, array $e

$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]));
Expand All @@ -156,7 +156,7 @@ public function testEnableTheme(string $toEnable, array $enabledThemes, array $e

public function dataTestDisableTheme() {
return [
['dark', [], []],
['dark', ['default'], ['default']],
['dark', ['dark'], []],
['opendyslexic', ['dark', 'opendyslexic'], ['dark'], ],
['light-highcontrast', ['opendyslexic'], ['opendyslexic']],
Expand All @@ -181,7 +181,7 @@ public function testDisableTheme(string $toDisable, array $enabledThemes, array

$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));


Expand Down Expand Up @@ -215,7 +215,7 @@ public function testIsEnabled(string $themeId, array $enabledThemes, $expected):

$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));


Expand All @@ -234,14 +234,14 @@ public function testGetEnabledThemes(): void {

$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 {
Expand All @@ -256,7 +256,7 @@ public function testGetEnabledThemesEnforced(): void {

$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')
Expand Down
Loading