From 6a227c8ad37dc5238a78e05dbf93ee535c13f508 Mon Sep 17 00:00:00 2001 From: Shay Date: Wed, 24 Jul 2024 15:53:03 -0700 Subject: [PATCH] Check for via servers before trying to join room in policy list manager (#514) --- src/models/PolicyList.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/models/PolicyList.ts b/src/models/PolicyList.ts index ff24a75..0009504 100644 --- a/src/models/PolicyList.ts +++ b/src/models/PolicyList.ts @@ -658,9 +658,19 @@ export class PolicyListManager { const permalink = Permalinks.parseUrl(roomRef); if (!permalink.roomIdOrAlias) return null; - const roomId = await this.mjolnir.client.resolveRoom(permalink.roomIdOrAlias); + let roomId: string; + let viaServers; + if (permalink.roomIdOrAlias.startsWith("!")) { + roomId = permalink.roomIdOrAlias + viaServers = permalink.viaServers + } else { + const roomInfo = await this.mjolnir.client.lookupRoomAlias(permalink.roomIdOrAlias) + roomId = roomInfo.roomId + viaServers = roomInfo.residentServers + } + if (!joinedRooms.includes(roomId)) { - await this.mjolnir.client.joinRoom(roomId, permalink.viaServers); + await this.mjolnir.client.joinRoom(roomId, viaServers); } if (this.policyLists.find(b => b.roomId === roomId)) {