Check for via servers before trying to join room in policy list manager (#514)

This commit is contained in:
Shay 2024-07-24 15:53:03 -07:00 committed by GitHub
parent 2f6120eca9
commit 6a227c8ad3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -658,9 +658,19 @@ export class PolicyListManager {
const permalink = Permalinks.parseUrl(roomRef); const permalink = Permalinks.parseUrl(roomRef);
if (!permalink.roomIdOrAlias) return null; 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)) { 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)) { if (this.policyLists.find(b => b.roomId === roomId)) {