From cd4564d3d3724219c165dc1461b5d47deb35627f Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 15 Sep 2016 18:56:04 +0100 Subject: [PATCH] Make the matrix.org section be everything (ie. every alias on the matrix.org HS, so currently everything, since we don't pull in any other directories) --- src/components/structures/RoomDirectory.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index ae05851122..3d82499687 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -223,7 +223,7 @@ module.exports = React.createClass({ // FIXME: if incrementally typing, keep narrowing down the search set // incrementally rather than starting over each time. if (this.state.filterByNetwork) { - if (this._networkForRoom(a) != this.state.filterByNetwork) return false; + if (!this._isRoomInNetwork(a, this.state.filterByNetwork)) return false; } return (((a.name && a.name.toLowerCase().search(filter.toLowerCase()) >= 0) || @@ -301,16 +301,14 @@ module.exports = React.createClass({ * Terrible temporary function that guess what network a public room * entry is in, until synapse is able to tell us */ - _networkForRoom(room) { - if (room.aliases) { + _isRoomInNetwork(room, network) { + if (room.aliases && this.networkPatterns[network]) { for (const alias of room.aliases) { - for (const network of Object.keys(this.networkPatterns)) { - if (this.networkPatterns[network].test(alias)) return network; - } + if (this.networkPatterns[network].test(alias)) return true; } } - return 'matrix:matrix_org'; + return false; }, render: function() {