Link rooms with `?via` query paramter from room directory landing page (#104)

Fix https://github.com/matrix-org/matrix-public-archive/issues/91

So we're always able to join the room from our origin homeserver to the remote room we don't know about yet.
This commit is contained in:
Eric Eastwood 2022-10-21 16:06:11 -05:00 committed by GitHub
parent 3b4fb52bfe
commit d2d6c5a580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 14 deletions

View File

@ -34,20 +34,6 @@ class RoomDirectoryViewModel extends ViewModel {
this._homeserverUrl = homeserverUrl;
this._homeserverName = homeserverName;
this._matrixPublicArchiveURLCreator = matrixPublicArchiveURLCreator;
this._rooms = new ObservableArray(
rooms.map((room) => {
return {
roomId: room.room_id,
canonicalAlias: room.canonical_alias,
name: room.name,
mxcAvatarUrl: room.avatar_url,
homeserverUrlToPullMediaFrom: homeserverUrl,
numJoinedMembers: room.num_joined_members,
topic: room.topic,
archiveRoomUrl: matrixPublicArchiveURLCreator.archiveUrlForRoom(room.room_id),
};
})
);
this._pageSearchParameters = pageSearchParameters;
// Default to what the page started with
@ -78,6 +64,23 @@ class RoomDirectoryViewModel extends ViewModel {
})
);
this._rooms = new ObservableArray(
rooms.map((room) => {
return {
roomId: room.room_id,
canonicalAlias: room.canonical_alias,
name: room.name,
mxcAvatarUrl: room.avatar_url,
homeserverUrlToPullMediaFrom: homeserverUrl,
numJoinedMembers: room.num_joined_members,
topic: room.topic,
archiveRoomUrl: matrixPublicArchiveURLCreator.archiveUrlForRoom(room.room_id, {
viaServers: [this.pageSearchParameters.homeserver],
}),
};
})
);
this.#setupNavigation();
}