aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2025-04-04 10:16:34 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2025-04-04 10:16:34 +0200
commitcfdd691f28c7fb6789b98ff4e7335585514e0959 (patch)
treee8e376fd4c1d2ceb4e1065d729d28219585485e2
parenta35f4b16ac42ed73d7b540e40b72aaa160051f0f (diff)
downloadnextcloud-server-fix/master-template-layout.tar.gz
nextcloud-server-fix/master-template-layout.zip
fix: ensure enabled (enforced) themes are always set on template layoutfix/master-template-layout
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-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 b109d023ca3..109050a3784 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', '');
@@ -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();