From 51c78809e6b9a55244175ef385f3703d65272a7f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 23 Mar 2020 12:34:23 +0100 Subject: [PATCH] filter room list by canonical and alternative aliases --- src/components/views/rooms/RoomList.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 2143c7f1a8..4327f93d9f 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -596,8 +596,13 @@ export default createReactClass({ // case insensitive if room name includes filter, // or if starts with `#` and one of room's aliases starts with filter return list.filter((room) => { - if (filter[0] === "#" && room.getAliases().some((alias) => alias.toLowerCase().startsWith(lcFilter))) { - return true; + if (filter[0] === "#") { + if (room.getCanonicalAlias() && room.getCanonicalAlias().toLowerCase().startsWith(lcFilter)) { + return true; + } + if (room.getAltAliases().some((alias) => alias.toLowerCase().startsWith(lcFilter))) { + return true; + } } return room.name && utils.removeHiddenChars(room.name.toLowerCase()).toLowerCase().includes(fuzzyFilter); });