mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
Resolve aliases and get via servers before storing watch list (#518)
This commit is contained in:
parent
9e8546366a
commit
1c5b49df54
@ -659,10 +659,19 @@ export class PolicyListManager {
|
|||||||
if (!permalink.roomIdOrAlias) return null;
|
if (!permalink.roomIdOrAlias) return null;
|
||||||
|
|
||||||
let roomId: string;
|
let roomId: string;
|
||||||
let viaServers;
|
let viaServers: string[];
|
||||||
if (permalink.roomIdOrAlias.startsWith("!")) {
|
if (permalink.roomIdOrAlias.startsWith("!")) {
|
||||||
roomId = permalink.roomIdOrAlias
|
// if we only have a room id, see if there's an alias we can use to get any possible
|
||||||
viaServers = permalink.viaServers
|
// 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 {
|
} else {
|
||||||
const roomInfo = await this.mjolnir.client.lookupRoomAlias(permalink.roomIdOrAlias)
|
const roomInfo = await this.mjolnir.client.lookupRoomAlias(permalink.roomIdOrAlias)
|
||||||
roomId = roomInfo.roomId
|
roomId = roomInfo.roomId
|
||||||
@ -682,7 +691,8 @@ export class PolicyListManager {
|
|||||||
return null;
|
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();
|
await this.storeWatchedPolicyLists();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user