From: Benjamin Gaussorgues Date: Fri, 24 Nov 2023 16:00:50 +0000 (+0100) Subject: feat(dav): hide search providers if their respective app is not activated X-Git-Tag: v29.0.0beta1~783^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2a4465dc1bdce99f3628b14761741cb4cd9bd3b2;p=nextcloud-server.git feat(dav): hide search providers if their respective app is not activated Signed-off-by: Benjamin Gaussorgues --- diff --git a/apps/dav/lib/Search/ContactsSearchProvider.php b/apps/dav/lib/Search/ContactsSearchProvider.php index 265f4958efb..2a0e70bf045 100644 --- a/apps/dav/lib/Search/ContactsSearchProvider.php +++ b/apps/dav/lib/Search/ContactsSearchProvider.php @@ -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 { diff --git a/apps/dav/lib/Search/EventsSearchProvider.php b/apps/dav/lib/Search/EventsSearchProvider.php index 0cf01742672..dd87f486a1d 100644 --- a/apps/dav/lib/Search/EventsSearchProvider.php +++ b/apps/dav/lib/Search/EventsSearchProvider.php @@ -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; } /** diff --git a/apps/dav/lib/Search/TasksSearchProvider.php b/apps/dav/lib/Search/TasksSearchProvider.php index 91692ea1c2a..5cb64556457 100644 --- a/apps/dav/lib/Search/TasksSearchProvider.php +++ b/apps/dav/lib/Search/TasksSearchProvider.php @@ -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; } /**