Skip to content

Commit

Permalink
Merge pull request #41738 from nextcloud/feat/hide-dav-search-provide…
Browse files Browse the repository at this point in the history
…r-if-no-app
  • Loading branch information
Altahrim authored Nov 27, 2023
2 parents 3ccb301 + 2a4465d commit e416279
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
9 changes: 5 additions & 4 deletions apps/dav/lib/Search/ContactsSearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ public function getName(): string {
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 {
Expand Down
9 changes: 5 additions & 4 deletions apps/dav/lib/Search/EventsSearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ public function getName(): string {
/**
* @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;
}

/**
Expand Down
9 changes: 5 additions & 4 deletions apps/dav/lib/Search/TasksSearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ public function getName(): string {
/**
* @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;
}

/**
Expand Down

0 comments on commit e416279

Please sign in to comment.