This commit is contained in:
Shay 2024-09-11 16:31:07 -06:00 committed by GitHub
commit 6667b23c4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -659,10 +659,19 @@ export class PolicyListManager {
if (!permalink.roomIdOrAlias) return null;
let roomId: string;
let viaServers;
let viaServers: string[];
if (permalink.roomIdOrAlias.startsWith("!")) {
roomId = permalink.roomIdOrAlias
viaServers = permalink.viaServers
// 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)
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
@ -682,7 +691,8 @@ export class PolicyListManager {
return null;
}
const list = await this.addPolicyList(roomId, roomRef);
const newRef = Permalinks.forRoom(roomId, viaServers)
const list = await this.addPolicyList(roomId, newRef);
await this.storeWatchedPolicyLists();