Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Keep Search Provider but remove actual search and display on the sear…
…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 authored and blizzz committed Oct 12, 2023
commit d657ded9bfb48240c4c1f91cf7d648f57da07eb2
30 changes: 1 addition & 29 deletions apps/settings/lib/Search/UserSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,37 +101,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
[]
);
}
}