Merge pull request #5776 from matrix-org/t3chguy/spaces4.10

Improve discovery of rooms in a space
This commit is contained in:
Michael Telatynski 2021-03-22 13:24:23 +00:00 committed by GitHub
commit 03ab2dc8e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 527 additions and 436 deletions

View file

@ -257,10 +257,10 @@ const SpaceLanding = ({ space }) => {
try {
const data = await cli.getSpaceSummary(space.roomId, undefined, myMembership !== "join");
const parentChildRelations = new EnhancedMap<string, string[]>();
const parentChildRelations = new EnhancedMap<string, Map<string, ISpaceSummaryEvent>>();
data.events.map((ev: ISpaceSummaryEvent) => {
if (ev.type === EventType.SpaceChild) {
parentChildRelations.getOrCreate(ev.room_id, []).push(ev.state_key);
parentChildRelations.getOrCreate(ev.room_id, new Map()).set(ev.state_key, ev);
}
});
@ -284,11 +284,10 @@ const SpaceLanding = ({ space }) => {
<HierarchyLevel
spaceId={space.roomId}
rooms={roomsMap}
editing={false}
relations={relations}
parents={new Set()}
onPreviewClick={roomId => {
showRoom(roomsMap.get(roomId), [], false); // TODO
onViewRoomClick={(roomId, autoJoin) => {
showRoom(roomsMap.get(roomId), [], autoJoin);
}}
/>
</AutoHideScrollbar>;