Skip to content

Commit

Permalink
handle case where there's no alias
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay committed Aug 22, 2024
1 parent de11771 commit 914af63
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/models/PolicyList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,17 @@ export class PolicyListManager {
let roomId: string;
let viaServers: string[];
if (permalink.roomIdOrAlias.startsWith("!")) {
// get alias and then use alias to get via servers
// if we only have a room id, see if there's an alias we can use to get any possible
// via servers
const alias = await this.mjolnir.client.getPublishedAlias(permalink.roomIdOrAlias)
const roomInformation = await this.mjolnir.client.lookupRoomAlias(alias)
roomId = permalink.roomIdOrAlias
viaServers = roomInformation.residentServers
if (alias) {
const roomInformation = await this.mjolnir.client.lookupRoomAlias(alias)
roomId = permalink.roomIdOrAlias
viaServers = roomInformation.residentServers
} else {
roomId = permalink.roomIdOrAlias
viaServers = permalink.viaServers
}
} else {
const roomInfo = await this.mjolnir.client.lookupRoomAlias(permalink.roomIdOrAlias)
roomId = roomInfo.roomId
Expand Down

0 comments on commit 914af63

Please sign in to comment.