Test and fix subspace invite receipt behaviour

pull/21833/head
Michael Telatynski 2021-04-24 11:31:52 +01:00
parent dd2a1d063a
commit f85d3643ee
2 changed files with 13 additions and 1 deletions

View File

@ -203,7 +203,8 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
}
public getChildSpaces(spaceId: string): Room[] {
return this.getChildren(spaceId).filter(r => r.isSpaceRoom());
// don't show invited subspaces as they surface at the top level for better visibility
return this.getChildren(spaceId).filter(r => r.isSpaceRoom() && r.getMyMembership() === "join");
}
public getParents(roomId: string, canonicalOnly = false): Room[] {

View File

@ -288,6 +288,17 @@ describe("SpaceStore", () => {
expect(store.getChildSpaces("!d:server")).toStrictEqual([]);
});
it("invite to a subspace is only shown at the top level", async () => {
mkSpace(invite1).getMyMembership.mockReturnValue("invite");
mkSpace(space1, [invite1]);
await run();
expect(store.spacePanelSpaces).toStrictEqual([client.getRoom(space1)]);
expect(store.getChildSpaces(space1)).toStrictEqual([]);
expect(store.getChildRooms(space1)).toStrictEqual([]);
expect(store.invitedSpaces).toStrictEqual([client.getRoom(invite1)]);
});
describe("test fixture 1", () => {
beforeEach(async () => {
[fav1, fav2, fav3, dm1, dm2, dm3, orphan1, orphan2, invite1, invite2, room1].forEach(mkRoom);