Merge pull request #52391 from nextcloud/fix/harden-template-functions

fix(Template): harden enabled-theme logic
ci/49145/php-8.4-external-storages
Ferdinand Thiessen 2025-04-24 07:38:20 +07:00 committed by GitHub
commit 9fce0f9297
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 8 deletions

@ -144,12 +144,6 @@ class TemplateLayout {
$userDisplayName = $user->getDisplayName();
}
$page->assign('enabledThemes', []);
if ($this->appManager->isEnabledForUser('theming') && class_exists('\OCA\Theming\Service\ThemesService')) {
$themesService = Server::get(\OCA\Theming\Service\ThemesService::class);
$page->assign('enabledThemes', $themesService->getEnabledThemes());
}
$page->assign('user_displayname', $userDisplayName);
$page->assign('user_uid', \OC_User::getUser());
break;
@ -200,10 +194,9 @@ class TemplateLayout {
// Set body data-theme
try {
$themesService = Server::get(\OCA\Theming\Service\ThemesService::class);
} catch (\OCP\AppFramework\QueryException) {
} catch (\Exception) {
$themesService = null;
}
$page->assign('enabledThemes', $themesService?->getEnabledThemes() ?? []);
if ($this->config->getSystemValueBool('installed', false)) {