Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable24] Fix channel name autocomplete #8506

Merged
merged 2 commits into from Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Chat/ChatManager.php
Expand Up @@ -676,7 +676,7 @@ public function addConversationNotify(array $results, string $search, Room $room
}

private function searchIsPartOfConversationNameOrAtAll(string $search, string $roomDisplayName): bool {
if (stripos($roomDisplayName, $search) === 0) {
if (stripos($roomDisplayName, $search) !== false) {
return true;
}
if (strpos('all', $search) === 0) {
Expand Down
39 changes: 30 additions & 9 deletions tests/php/Chat/ChatManagerTest.php
Expand Up @@ -643,15 +643,36 @@ public function testClearHistory(): void {

public function dataSearchIsPartOfConversationNameOrAtAll(): array {
return [
['a', 'test', true],
['h', 'test', true],
['A', 'test', false],
['H', 'test', false],
['T', 'test', true],
['t', 'test', true],
['notbeginingall', 'test', false],
['notbegininghere', 'test', false],
['notbeginingtest', 'test', false]
'found a in all' => [
'a', 'room', true
],
'found h in here' => [
'h', 'room', true
],
'case sensitive, not found A in all' => [
'A', 'room', false
],
'case sensitive, not found H in here' => [
'H', 'room', false
],
'non case sensitive, found r in room' => [
'R', 'room', true
],
'found r in begin of room' => [
'r', 'room', true
],
'found o in middle of room' => [
'o', 'room', true
],
'not found all in middle of text' => [
'notbeginingall', 'room', false
],
'not found here in middle of text' => [
'notbegininghere', 'room', false
],
'not found room in middle of text' => [
'notbeginingroom', 'room', false
],
];
}

Expand Down