Skip to content

Commit 3bdf3be

Browse files
authored
Merge pull request matrix-org#4769 from matrix-org/travis/room-list/fuzzy-filter
Match fuzzy filtering a bit more reliably in the new room list
2 parents f08efc6 + bc0281e commit 3bdf3be

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/stores/room-list/filters/NameFilterCondition.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ export class NameFilterCondition extends EventEmitter implements IFilterConditio
5656
return true;
5757
}
5858
}
59-
return room.name && removeHiddenChars(room.name).toLowerCase().includes(lcFilter);
59+
60+
if (!room.name) return false; // should realisitically not happen: the js-sdk always calculates a name
61+
62+
// Note: we have to match the filter with the removeHiddenChars() room name because the
63+
// function strips spaces and other characters (M becomes RN for example, in lowercase).
64+
// We also doubly convert to lowercase to work around oddities of the library.
65+
const noSecretsFilter = removeHiddenChars(lcFilter).toLowerCase();
66+
const noSecretsName = removeHiddenChars(room.name.toLowerCase()).toLowerCase();
67+
return noSecretsName.includes(noSecretsFilter);
6068
}
6169
}

0 commit comments

Comments
 (0)