зеркало из https://github.com/nextcloud/spreed.git
Make the search case-insensitive
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
37dad5b037
Коммит
4cf756fbe6
|
@ -69,6 +69,8 @@ class SearchPlugin implements ISearchPlugin {
|
|||
}
|
||||
|
||||
protected function searchUsers($search, array $userIds, ISearchResult $searchResult) {
|
||||
$search = strtolower($search);
|
||||
|
||||
$matches = $exactMatches = [];
|
||||
foreach ($userIds as $userId) {
|
||||
if ($this->userId !== '' && $this->userId === $userId) {
|
||||
|
@ -81,12 +83,12 @@ class SearchPlugin implements ISearchPlugin {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($userId === $search) {
|
||||
if (strtolower($userId) === $search) {
|
||||
$exactMatches[] = $this->createResult('user', $userId, '');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($userId, $search) !== false) {
|
||||
if (strpos(strtolower($userId), $search) !== false) {
|
||||
$matches[] = $this->createResult('user', $userId, '');
|
||||
continue;
|
||||
}
|
||||
|
@ -96,12 +98,12 @@ class SearchPlugin implements ISearchPlugin {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($user->getDisplayName() === $search) {
|
||||
if (strtolower($user->getDisplayName()) === $search) {
|
||||
$exactMatches[] = $this->createResult('user', $user->getUID(), $user->getDisplayName());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($user->getDisplayName(), $search) !== false) {
|
||||
if (strpos(strtolower($user->getDisplayName()), $search) !== false) {
|
||||
$matches[] = $this->createResult('user', $user->getUID(), $user->getDisplayName());
|
||||
continue;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче