mirror of https://github.com/vector-im/riot-web
Do not search through room topics
parent
120e7b821f
commit
b3674f503d
|
@ -271,21 +271,18 @@ module.exports = React.createClass({
|
||||||
const results = [];
|
const results = [];
|
||||||
rooms.forEach((room) => {
|
rooms.forEach((room) => {
|
||||||
const nameEvent = room.currentState.getStateEvents('m.room.name', '');
|
const nameEvent = room.currentState.getStateEvents('m.room.name', '');
|
||||||
const topicEvent = room.currentState.getStateEvents('m.room.topic', '');
|
|
||||||
const name = nameEvent ? nameEvent.getContent().name : '';
|
const name = nameEvent ? nameEvent.getContent().name : '';
|
||||||
const canonicalAlias = room.getCanonicalAlias();
|
const canonicalAlias = room.getCanonicalAlias();
|
||||||
const aliasEvents = room.currentState.getStateEvents('m.room.aliases');
|
const aliasEvents = room.currentState.getStateEvents('m.room.aliases');
|
||||||
const aliases = aliasEvents.map((ev) => ev.getContent().aliases).reduce((a, b) => {
|
const aliases = aliasEvents.map((ev) => ev.getContent().aliases).reduce((a, b) => {
|
||||||
return a.concat(b);
|
return a.concat(b);
|
||||||
}, []);
|
}, []);
|
||||||
const topic = topicEvent ? topicEvent.getContent().topic : '';
|
|
||||||
|
|
||||||
const nameMatch = (name || '').toLowerCase().includes(lowerCaseQuery);
|
const nameMatch = (name || '').toLowerCase().includes(lowerCaseQuery);
|
||||||
const aliasMatch = aliases.some((alias) =>
|
const aliasMatch = aliases.some((alias) =>
|
||||||
(alias || '').toLowerCase().includes(lowerCaseQuery),
|
(alias || '').toLowerCase().includes(lowerCaseQuery),
|
||||||
);
|
);
|
||||||
const topicMatch = (topic || '').toLowerCase().includes(lowerCaseQuery);
|
if (!(nameMatch || aliasMatch)) {
|
||||||
if (!(nameMatch || topicMatch || aliasMatch)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const avatarEvent = room.currentState.getStateEvents('m.room.avatar', '');
|
const avatarEvent = room.currentState.getStateEvents('m.room.avatar', '');
|
||||||
|
|
Loading…
Reference in New Issue