tidy up if statements and fix up comments
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
41be46a712
commit
384c974589
|
@ -106,15 +106,10 @@ var RoomSubList = React.createClass({
|
||||||
applySearchFilter: function(list, filter) {
|
applySearchFilter: function(list, filter) {
|
||||||
if (filter === "") return list;
|
if (filter === "") return list;
|
||||||
const lcFilter = filter.toLowerCase();
|
const lcFilter = filter.toLowerCase();
|
||||||
return list.filter((room) => {
|
// case insensitive if room name includes filter,
|
||||||
if (room.name && room.name.toLowerCase().includes(lcFilter)) return true;
|
// or if starts with `#` and one of room's aliases starts with filter
|
||||||
// only apply search filter to aliases if it looks like an alias (starts with `#`)
|
return list.filter((room) => (room.name && room.name.toLowerCase().includes(lcFilter)) ||
|
||||||
// to prevent loads of false positives with server names, e.g `matrix`
|
(filter[0] === '#' && room.getAliases().some((alias) => alias.toLowerCase().startsWith(lcFilter))));
|
||||||
if (filter[0] === '#' && room.getAliases().some((alias) => {
|
|
||||||
return alias.toLowerCase().startsWith(lcFilter);
|
|
||||||
})) return true;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// The header is collapsable if it is hidden or not stuck
|
// The header is collapsable if it is hidden or not stuck
|
||||||
|
|
Loading…
Reference in New Issue