From b84fd245b19b85546953bc9d6f4fb85d5aaea5cc Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 30 Jan 2020 18:03:45 +0000 Subject: [PATCH 1/2] Fix room completion for invited rooms and upgraded rooms Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/autocomplete/RoomProvider.js | 2 +- src/editor/parts.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/autocomplete/RoomProvider.js b/src/autocomplete/RoomProvider.js index b28c79ac54..fccf1e3524 100644 --- a/src/autocomplete/RoomProvider.js +++ b/src/autocomplete/RoomProvider.js @@ -56,7 +56,7 @@ export default class RoomProvider extends AutocompleteProvider { const {command, range} = this.getCurrentCommand(query, selection, force); if (command) { // the only reason we need to do this is because Fuse only matches on properties - let matcherObjects = client.getRooms().filter( + let matcherObjects = client.getVisibleRooms().filter( (room) => !!room && !!getDisplayAliasForRoom(room), ).map((room) => { return { diff --git a/src/editor/parts.js b/src/editor/parts.js index 137018d7e9..cb801740d4 100644 --- a/src/editor/parts.js +++ b/src/editor/parts.js @@ -426,7 +426,7 @@ export class PartCreator { let room; if (alias[0] === '#') { room = this._client.getRooms().find((r) => { - return r.getAliases().includes(alias); + return r.getAliases().includes(alias) || r.getCanonicalAlias() === alias; }); } else { room = this._client.getRoom(alias); From 7e45979e00904d039d002a1f598bfa81cc548b30 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 30 Jan 2020 20:59:30 +0000 Subject: [PATCH 2/2] change order of if or conditions as micro-optimization Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/editor/parts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor/parts.js b/src/editor/parts.js index cb801740d4..652342405f 100644 --- a/src/editor/parts.js +++ b/src/editor/parts.js @@ -426,7 +426,7 @@ export class PartCreator { let room; if (alias[0] === '#') { room = this._client.getRooms().find((r) => { - return r.getAliases().includes(alias) || r.getCanonicalAlias() === alias; + return r.getCanonicalAlias() === alias || r.getAliases().includes(alias); }); } else { room = this._client.getRoom(alias);