mirror of https://github.com/vector-im/riot-web
apply roomlist searchFilter to aliases if it begins with a `#`
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
e858cf3bcb
commit
41be46a712
|
@ -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;
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue