From 0d8aa6894afa13e053e6a4c9e283b80d04a26ebd Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Tue, 21 Nov 2023 18:16:01 +0100 Subject: [PATCH] feat(search): hide user search if not on user list Signed-off-by: Benjamin Gaussorgues --- apps/settings/lib/Search/UserSearch.php | 35 ++++++------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/apps/settings/lib/Search/UserSearch.php b/apps/settings/lib/Search/UserSearch.php index 24dd56c283c..20cdcfc2c42 100644 --- a/apps/settings/lib/Search/UserSearch.php +++ b/apps/settings/lib/Search/UserSearch.php @@ -6,7 +6,7 @@ declare(strict_types=1); * @copyright Copyright (c) 2023 Stephan Orbaugh * * @author Stephan Orbaugh - * + * @author Benjamin Gaussorgues * * @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'), []); } }