diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-04 17:48:30 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-09 11:04:36 +0200 |
commit | d5e98cd190249906aa7547528b3e7123fb6cb94b (patch) | |
tree | d44477ca2d45a090e8452d21e0cb7d2fcf7b97eb /apps | |
parent | 0a3093d05da92036684afb5814a4925b443468f7 (diff) | |
download | nextcloud-server-d5e98cd190249906aa7547528b3e7123fb6cb94b.tar.gz nextcloud-server-d5e98cd190249906aa7547528b3e7123fb6cb94b.zip |
fix(NavigationManager): Skip invalid default navigation entries
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/theming/lib/Settings/Admin.php | 4 | ||||
-rw-r--r-- | apps/theming/tests/Settings/AdminTest.php | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/apps/theming/lib/Settings/Admin.php b/apps/theming/lib/Settings/Admin.php index 640a2a8346d..24ac0729de5 100644 --- a/apps/theming/lib/Settings/Admin.php +++ b/apps/theming/lib/Settings/Admin.php @@ -14,6 +14,7 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\IConfig; use OCP\IL10N; +use OCP\INavigationManager; use OCP\IURLGenerator; use OCP\Settings\IDelegatedSettings; use OCP\Util; @@ -28,6 +29,7 @@ class Admin implements IDelegatedSettings { private IInitialState $initialState, private IURLGenerator $urlGenerator, private ImageManager $imageManager, + private INavigationManager $navigationManager, ) { } @@ -70,7 +72,7 @@ class Admin implements IDelegatedSettings { 'docUrlIcons' => $this->urlGenerator->linkToDocs('admin-theming-icons'), 'canThemeIcons' => $this->imageManager->shouldReplaceIcons(), 'userThemingDisabled' => $this->themingDefaults->isUserThemingDisabled(), - 'defaultApps' => array_filter(explode(',', $this->config->getSystemValueString('defaultapp', ''))), + 'defaultApps' => $this->navigationManager->getDefaultEntryIds(), ]); Util::addScript($this->appName, 'admin-theming'); diff --git a/apps/theming/tests/Settings/AdminTest.php b/apps/theming/tests/Settings/AdminTest.php index 489d807673f..d74668f5e6f 100644 --- a/apps/theming/tests/Settings/AdminTest.php +++ b/apps/theming/tests/Settings/AdminTest.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\IConfig; use OCP\IL10N; +use OCP\INavigationManager; use OCP\IURLGenerator; use Test\TestCase; @@ -24,6 +25,7 @@ class AdminTest extends TestCase { private IURLGenerator $urlGenerator; private ImageManager $imageManager; private IL10N $l10n; + private INavigationManager $navigationManager; protected function setUp(): void { parent::setUp(); @@ -33,6 +35,7 @@ class AdminTest extends TestCase { $this->initialState = $this->createMock(IInitialState::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->imageManager = $this->createMock(ImageManager::class); + $this->navigationManager = $this->createMock(INavigationManager::class); $this->admin = new Admin( Application::APP_ID, @@ -41,7 +44,8 @@ class AdminTest extends TestCase { $this->themingDefaults, $this->initialState, $this->urlGenerator, - $this->imageManager + $this->imageManager, + $this->navigationManager, ); } |