Test and fix subspace invite receipt behaviour
This commit is contained in:
parent
dd2a1d063a
commit
f85d3643ee
2 changed files with 13 additions and 1 deletions
|
@ -203,7 +203,8 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getChildSpaces(spaceId: string): Room[] {
|
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[] {
|
public getParents(roomId: string, canonicalOnly = false): Room[] {
|
||||||
|
|
|
@ -288,6 +288,17 @@ describe("SpaceStore", () => {
|
||||||
expect(store.getChildSpaces("!d:server")).toStrictEqual([]);
|
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", () => {
|
describe("test fixture 1", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
[fav1, fav2, fav3, dm1, dm2, dm3, orphan1, orphan2, invite1, invite2, room1].forEach(mkRoom);
|
[fav1, fav2, fav3, dm1, dm2, dm3, orphan1, orphan2, invite1, invite2, room1].forEach(mkRoom);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue