]> source.dussan.org Git - nextcloud-server.git/commitdiff
feat(dav): hide search providers if their respective app is not activated 41738/head
authorBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Fri, 24 Nov 2023 16:00:50 +0000 (17:00 +0100)
committerBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Mon, 27 Nov 2023 08:38:22 +0000 (09:38 +0100)
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
apps/dav/lib/Search/ContactsSearchProvider.php
apps/dav/lib/Search/EventsSearchProvider.php
apps/dav/lib/Search/TasksSearchProvider.php

index 265f4958efbfd35a2f514a7a704dc937a872684b..2a0e70bf045cc0df688039ee1aa411cd7f9df94f 100644 (file)
@@ -83,11 +83,12 @@ class ContactsSearchProvider implements IFilteringProvider {
                return $this->l10n->t('Contacts');
        }
 
-       public function getOrder(string $route, array $routeParameters): int {
-               if ($route === 'contacts.Page.index') {
-                       return -1;
+       public function getOrder(string $route, array $routeParameters): ?int {
+               if ($this->appManager->isEnabledForUser('contacts')) {
+                       return $route === 'contacts.Page.index' ? -1 : 25;
                }
-               return 25;
+
+               return null;
        }
 
        public function search(IUser $user, ISearchQuery $query): SearchResult {
index 0cf01742672c36e756df6fa32cd02fe516b52c1a..dd87f486a1d3e9e1968ce6dd8b9fa52ac8e3d540 100644 (file)
@@ -89,11 +89,12 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering
        /**
         * @inheritDoc
         */
-       public function getOrder(string $route, array $routeParameters): int {
-               if ($route === 'calendar.View.index') {
-                       return -1;
+       public function getOrder(string $route, array $routeParameters): ?int {
+               if ($this->appManager->isEnabledForUser('calendar')) {
+                       return $route === 'calendar.View.index' ? -1 : 30;
                }
-               return 30;
+
+               return null;
        }
 
        /**
index 91692ea1c2ab749af4575eb3dc8fe847858c1db6..5cb64556457eb6bb907f13a19c482e0592a03847 100644 (file)
@@ -77,11 +77,12 @@ class TasksSearchProvider extends ACalendarSearchProvider {
        /**
         * @inheritDoc
         */
-       public function getOrder(string $route, array $routeParameters): int {
-               if ($route === 'tasks.Page.index') {
-                       return -1;
+       public function getOrder(string $route, array $routeParameters): ?int {
+               if ($this->appManager->isEnabledForUser('tasks')) {
+                       return $route === 'tasks.Page.index' ? -1 : 35;
                }
-               return 35;
+
+               return null;
        }
 
        /**