Make the search case-insensitive

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-04-26 09:39:55 +02:00 коммит произвёл Daniel Calviño Sánchez
Родитель 37dad5b037
Коммит 4cf756fbe6
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -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;
}