apply roomlist searchFilter to aliases if it begins with a #
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
e858cf3bcb
commit
41be46a712
1 changed files with 8 additions and 1 deletions
|
@ -105,8 +105,15 @@ var RoomSubList = React.createClass({
|
||||||
|
|
||||||
applySearchFilter: function(list, filter) {
|
applySearchFilter: function(list, filter) {
|
||||||
if (filter === "") return list;
|
if (filter === "") return list;
|
||||||
|
const lcFilter = filter.toLowerCase();
|
||||||
return list.filter((room) => {
|
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;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue