You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
apply roomlist searchFilter to aliases if it begins with a #
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -105,8 +105,15 @@ var RoomSubList = React.createClass({
|
||||
|
||||
applySearchFilter: function(list, filter) {
|
||||
if (filter === "") return list;
|
||||
const lcFilter = filter.toLowerCase();
|
||||
return list.filter((room) => {
|
||||
return room.name && room.name.toLowerCase().indexOf(filter.toLowerCase()) >= 0
|
||||
if (room.name && room.name.toLowerCase().includes(lcFilter)) return true;
|
||||
// only apply search filter to aliases if it looks like an alias (starts with `#`)
|
||||
// to prevent loads of false positives with server names, e.g `matrix`
|
||||
if (filter[0] === '#' && room.getAliases().some((alias) => {
|
||||
return alias.toLowerCase().startsWith(lcFilter);
|
||||
})) return true;
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user