diff --git a/apps/theming/lib/Service/ThemesService.php b/apps/theming/lib/Service/ThemesService.php index d7127173848bb..fba63923a2088 100644 --- a/apps/theming/lib/Service/ThemesService.php +++ b/apps/theming/lib/Service/ThemesService.php @@ -164,8 +164,7 @@ public function isEnabled(ITheme $theme): bool { } /** - * 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 0000000000000..b24562933e8bb --- /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 5d29b06a73b8f..7d7002c71dbc9 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -112,13 +112,6 @@ public function __construct($renderAs, $appId = '') { } else { Util::addScript('core', 'unified-search', 'core'); } - // Set body data-theme - $this->assign('enabledThemes', []); - if ($this->appManager->isEnabledForUser('theming') && class_exists('\OCA\Theming\Service\ThemesService')) { - /** @var \OCA\Theming\Service\ThemesService */ - $themesService = \OC::$server->get(\OCA\Theming\Service\ThemesService::class); - $this->assign('enabledThemes', $themesService->getEnabledThemes()); - } // Set logo link target $logoUrl = $this->config->getSystemValueString('logo_url', ''); @@ -183,8 +176,6 @@ public function __construct($renderAs, $appId = '') { if ($user) { $userDisplayName = $user->getDisplayName(); } - $theme = $this->config->getSystemValueString('enforce_theme', ''); - $this->assign('enabledThemes', $theme === '' ? [] : [$theme]); $this->assign('user_displayname', $userDisplayName); $this->assign('user_uid', \OC_User::getUser()); } elseif ($renderAs === TemplateResponse::RENDER_AS_PUBLIC) { @@ -192,14 +183,6 @@ public function __construct($renderAs, $appId = '') { $this->assign('appid', $appId); $this->assign('bodyid', 'body-public'); - // Set body data-theme - $this->assign('enabledThemes', []); - if ($this->appManager->isEnabledForUser('theming') && class_exists('\OCA\Theming\Service\ThemesService')) { - /** @var \OCA\Theming\Service\ThemesService $themesService */ - $themesService = \OC::$server->get(\OCA\Theming\Service\ThemesService::class); - $this->assign('enabledThemes', $themesService->getEnabledThemes()); - } - // Set logo link target $logoUrl = $this->config->getSystemValueString('logo_url', ''); $this->assign('logoUrl', $logoUrl); @@ -227,9 +210,14 @@ public function __construct($renderAs, $appId = '') { } else { parent::__construct('core', 'layout.base'); } - // Send the language and the locale to our layouts - $lang = \OC::$server->getL10NFactory()->findLanguage(); - $locale = \OC::$server->getL10NFactory()->findLocale($lang); + + // Set body data-theme + $themesService = \OCP\Server::get(\OCA\Theming\Service\ThemesService::class); + $this->assign('enabledThemes', $themesService->getEnabledThemes()); + + // Send the language, locale, and direction to our layouts + $lang = \OC::$server->get(IFactory::class)->findLanguage(); + $locale = \OC::$server->get(IFactory::class)->findLocale($lang); $lang = str_replace('_', '-', $lang); $this->assign('language', $lang);