Remove space-specific right panel store handling

This is no longer needed as the right panel always corresponds to the currently viewed room/space only.

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-11-25 17:29:32 +00:00
parent a2a066d8b4
commit 3f221891f7
No known key found for this signature in database
GPG key ID: A2B008A5F49F5D0D
21 changed files with 53 additions and 83 deletions

View file

@ -97,7 +97,7 @@ describe("RightPanelStore", () => {
it("does nothing if given an invalid state", async () => {
await viewRoom("!1:example.org");
// Needs a member specified to be valid
store.setCard({ phase: RightPanelPhases.RoomMemberInfo }, true, "!1:example.org");
store.setCard({ phase: RightPanelPhases.MemberInfo }, true, "!1:example.org");
expect(store.roomPhaseHistory).toEqual([]);
});
it("only creates a single history entry if given the same card twice", async () => {
@ -114,15 +114,15 @@ describe("RightPanelStore", () => {
it("overwrites history if changing the phase", async () => {
await viewRoom("!1:example.org");
store.setCard({ phase: RightPanelPhases.RoomSummary }, true, "!1:example.org");
store.setCard({ phase: RightPanelPhases.RoomMemberList }, true, "!1:example.org");
expect(store.roomPhaseHistory).toEqual([{ phase: RightPanelPhases.RoomMemberList, state: {} }]);
store.setCard({ phase: RightPanelPhases.MemberList }, true, "!1:example.org");
expect(store.roomPhaseHistory).toEqual([{ phase: RightPanelPhases.MemberList, state: {} }]);
});
});
describe("setCards", () => {
it("overwrites history", async () => {
await viewRoom("!1:example.org");
store.setCard({ phase: RightPanelPhases.RoomMemberList }, true, "!1:example.org");
store.setCard({ phase: RightPanelPhases.MemberList }, true, "!1:example.org");
store.setCards(
[{ phase: RightPanelPhases.RoomSummary }, { phase: RightPanelPhases.PinnedMessages }],
true,
@ -200,21 +200,21 @@ describe("RightPanelStore", () => {
store.setCards(
[
{
phase: RightPanelPhases.RoomMemberList,
phase: RightPanelPhases.MemberList,
},
{
phase: RightPanelPhases.RoomMemberInfo,
phase: RightPanelPhases.MemberInfo,
state: { member: new RoomMember("!1:example.org", "@alice:example.org") },
},
],
true,
"!1:example.org",
);
expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.RoomMemberInfo);
expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.MemberInfo);
// Switch away and back
await viewRoom("!2:example.org");
await viewRoom("!1:example.org");
expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.RoomMemberList);
expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.MemberList);
});
});

View file

@ -30,7 +30,7 @@ describe("onView3pidInvite()", () => {
};
onView3pidInvite(payload, rightPanelStore);
expect(rightPanelStore.showOrHidePhase).toHaveBeenCalledWith(RightPanelPhases.RoomMemberList);
expect(rightPanelStore.showOrHidePhase).toHaveBeenCalledWith(RightPanelPhases.MemberList);
expect(rightPanelStore.pushCard).not.toHaveBeenCalled();
});
@ -43,7 +43,7 @@ describe("onView3pidInvite()", () => {
expect(rightPanelStore.showOrHidePhase).not.toHaveBeenCalled();
expect(rightPanelStore.pushCard).toHaveBeenCalledWith({
phase: RightPanelPhases.Room3pidMemberInfo,
phase: RightPanelPhases.ThreePidMemberInfo,
state: { memberInfoEvent: payload.event },
});
});