fix: ensure enabled (enforced) themes are always set on template layout

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/51933/head
Ferdinand Thiessen 9 months ago
parent a35f4b16ac
commit cfdd691f28
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
  1. 3
      apps/theming/lib/Service/ThemesService.php
  2. 19
      cypress/e2e/core/404-error.cy.ts
  3. 17
      lib/private/TemplateLayout.php

@ -148,8 +148,7 @@ class ThemesService {
}
/**
* Get the list of all enabled themes IDs
* for the logged-in user
* Get the list of all enabled themes IDs for the current user.
*
* @return string[]
*/

@ -0,0 +1,19 @@
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
describe('404 error page', { testIsolation: true }, () => {
it('renders 404 page', () => {
cy.visit('/doesnotexist', { failOnStatusCode: false })
cy.findByRole('heading', { name: /Page not found/ })
.should('be.visible')
cy.findByRole('link', { name: /Back to Nextcloud/ })
.should('be.visible')
.click()
cy.url()
.should('match', /(\/index.php)\/login$/)
})
})

@ -80,12 +80,6 @@ class TemplateLayout {
} else {
Util::addScript('core', 'unified-search', 'core');
}
// Set body data-theme
$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());
}
// Set logo link target
$logoUrl = $this->config->getSystemValueString('logo_url', '');
@ -157,13 +151,6 @@ class TemplateLayout {
$page->assign('appid', $appId);
$page->assign('bodyid', 'body-public');
// Set body data-theme
$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());
}
// Set logo link target
$logoUrl = $this->config->getSystemValueString('logo_url', '');
$page->assign('logoUrl', $logoUrl);
@ -203,6 +190,10 @@ class TemplateLayout {
$page->assign('locale', $locale);
$page->assign('direction', $direction);
// Set body data-theme
$themesService = Server::get(\OCA\Theming\Service\ThemesService::class);
$page->assign('enabledThemes', $themesService->getEnabledThemes());
if ($this->config->getSystemValueBool('installed', false)) {
if (empty(self::$versionHash)) {
$v = $this->appManager->getAppInstalledVersions();

Loading…
Cancel
Save