aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Search
diff options
context:
space:
mode:
authorBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>2023-11-24 17:00:50 +0100
committerBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>2023-11-27 09:38:22 +0100
commit2a4465dc1bdce99f3628b14761741cb4cd9bd3b2 (patch)
tree25d31ee48ecbe3ee1bc9286372457c772e243783 /apps/dav/lib/Search
parent011390aacbeed174716a76f9944b5db6757d6d0c (diff)
downloadnextcloud-server-2a4465dc1bdce99f3628b14761741cb4cd9bd3b2.tar.gz
nextcloud-server-2a4465dc1bdce99f3628b14761741cb4cd9bd3b2.zip
feat(dav): hide search providers if their respective app is not activated
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Diffstat (limited to 'apps/dav/lib/Search')
-rw-r--r--apps/dav/lib/Search/ContactsSearchProvider.php9
-rw-r--r--apps/dav/lib/Search/EventsSearchProvider.php9
-rw-r--r--apps/dav/lib/Search/TasksSearchProvider.php9
3 files changed, 15 insertions, 12 deletions
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;
}
/**