aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKate <26026535+provokateurin@users.noreply.github.com>2025-04-07 09:10:09 +0200
committerGitHub <noreply@github.com>2025-04-07 09:10:09 +0200
commit9bc946ac50e87fae67068c86bfe687f45258a9e8 (patch)
tree1559383ccef4bdd4f634de4aa133d65a0ce7a439
parentd8ff05649194d55861d5706e88da56aca4bc62ff (diff)
parentcfdd691f28c7fb6789b98ff4e7335585514e0959 (diff)
downloadnextcloud-server-9bc946ac50e87fae67068c86bfe687f45258a9e8.tar.gz
nextcloud-server-9bc946ac50e87fae67068c86bfe687f45258a9e8.zip
Merge pull request #51933 from nextcloud/fix/master-template-layout
fix: ensure enabled (enforced) themes are always set on template layout
-rw-r--r--apps/theming/lib/Service/ThemesService.php3
-rw-r--r--cypress/e2e/core/404-error.cy.ts19
-rw-r--r--lib/private/TemplateLayout.php17
3 files changed, 24 insertions, 15 deletions
diff --git a/apps/theming/lib/Service/ThemesService.php b/apps/theming/lib/Service/ThemesService.php
index 39a8eeff410..37ea47f80d8 100644
--- a/apps/theming/lib/Service/ThemesService.php
+++ b/apps/theming/lib/Service/ThemesService.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[]
*/
diff --git a/cypress/e2e/core/404-error.cy.ts b/cypress/e2e/core/404-error.cy.ts
new file mode 100644
index 00000000000..b24562933e8
--- /dev/null
+++ b/cypress/e2e/core/404-error.cy.ts
@@ -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$/)
+ })
+})
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index 2fc1f1a3791..d9c02619943 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -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', '');
@@ -164,13 +158,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);
@@ -210,6 +197,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();