Browse Source

feat(search): hide user search if not on user list

Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
tags/v28.0.0rc1
Benjamin Gaussorgues 6 months ago
parent
commit
0d8aa6894a
No account linked to committer's email address
1 changed files with 8 additions and 27 deletions
  1. 8
    27
      apps/settings/lib/Search/UserSearch.php

+ 8
- 27
apps/settings/lib/Search/UserSearch.php View File

@@ -6,7 +6,7 @@ declare(strict_types=1);
* @copyright Copyright (c) 2023 Stephan Orbaugh <stephan.orbaugh@nextcloud.com>
*
* @author Stephan Orbaugh <stephan.orbaugh@nextcloud.com>
*
* @author Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
*
* @license GNU AGPL version 3 or any later version
*
@@ -33,45 +33,26 @@ use OCP\Search\ISearchQuery;
use OCP\Search\SearchResult;

class UserSearch implements IProvider {


/** @var IL10N */
protected $l;

public function __construct(
IL10N $l) {
$this->l = $l;
private IL10N $l,
) {
}

/**
* @inheritDoc
*/
public function getId(): string {
return 'users';
}

/**
* @inheritDoc
*/
public function getName(): string {
return $this->l->t('Users');
}

/**
* @inheritDoc
*/
public function getOrder(string $route, array $routeParameters): int {
return 300;
public function getOrder(string $route, array $routeParameters): ?int {
return $route === 'settings.Users.usersList'
? 300
: null;
}

/**
* @inheritDoc
*/
public function search(IUser $user, ISearchQuery $query): SearchResult {

return SearchResult::complete(
$this->l->t('Users'),
[]
);
return SearchResult::complete($this->l->t('Users'), []);
}
}

Loading…
Cancel
Save