Skip to content

Commit

Permalink
Keep Search Provider but remove actual search and display on the sear…
Browse files Browse the repository at this point in the history
…chlist dialog. Will revisit in future search result list in future issue.

Usage:
1. Type a string in the search bar
2. Add in:users filter to avoid unnecessary searches in other apps
  • Loading branch information
sorbaugh committed Sep 14, 2023
1 parent 18d59d2 commit 664f3ad
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions apps/settings/lib/Search/UserSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,37 +102,9 @@ public function getOrder(string $route, array $routeParameters): int {
*/
public function search(IUser $user, ISearchQuery $query): SearchResult {

$users = $this->userManager->search($query->getTerm(), $query->getLimit(), 0);

if (!$this->groupManager->isAdmin($user->getUID())) {
return SearchResult::complete(
$this->l->t('Users'),
[]
);
}

foreach ($users as $user) {
$targetUserObject = $this->userManager->get($user->getUid());

if ($targetUserObject === null) {
throw new OCSNotFoundException('User does not exist');
}

$userAccount = $this->accountManager->getAccount($targetUserObject);
$avatar = $userAccount->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope();

$result[] = new SearchResultEntry(
'',
$targetUserObject->getDisplayName(),
$user->getUid(),
$this->urlGenerator->linkToRouteAbsolute('settings.Users.usersList'),
'icon-user-dark'
);
}

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

0 comments on commit 664f3ad

Please sign in to comment.