Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dav): hide search providers if their respective app is not activated #41738

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading