mirror of
https://github.com/vector-im/element-web.git
synced 2025-11-30 15:01:43 +01:00
Fix room list handling of membership changes (#31197)
* Fix room list handling of membership changes Including knock->invite for ask to join Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * lint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
39a5cca737
commit
f6e85a38d2
@ -260,7 +260,7 @@ export class RoomListStoreV3Class extends AsyncStoreWithClient<EmptyObject> {
|
||||
}
|
||||
}
|
||||
|
||||
this.addRoomAndEmit(payload.room, true);
|
||||
this.addRoomAndEmit(payload.room, oldMembership === EffectiveMembership.Leave);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import SettingsStore from "../../../../src/settings/SettingsStore";
|
||||
import * as utils from "../../../../src/utils/notifications";
|
||||
import * as roomMute from "../../../../src/stores/room-list/utils/roomMute";
|
||||
import { Action } from "../../../../src/dispatcher/actions";
|
||||
import { SettingLevel } from "../../../../src/settings/SettingLevel.ts";
|
||||
|
||||
describe("RoomListStoreV3", () => {
|
||||
async function getRoomListStore() {
|
||||
@ -218,7 +219,6 @@ describe("RoomListStoreV3", () => {
|
||||
dispatcher.dispatch(
|
||||
{
|
||||
action: "MatrixActions.Room.myMembership",
|
||||
oldMembership: KnownMembership.Invite,
|
||||
membership: KnownMembership.Join,
|
||||
room: newRoom,
|
||||
},
|
||||
@ -253,7 +253,6 @@ describe("RoomListStoreV3", () => {
|
||||
dispatcher.dispatch(
|
||||
{
|
||||
action: "MatrixActions.Room.myMembership",
|
||||
oldMembership: KnownMembership.Invite,
|
||||
membership: KnownMembership.Join,
|
||||
room: newRoom,
|
||||
},
|
||||
@ -759,6 +758,35 @@ describe("RoomListStoreV3", () => {
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result).toContain(rooms[8]);
|
||||
});
|
||||
|
||||
it("should update filters on membership change", async () => {
|
||||
await SettingsStore.setValue("feature_ask_to_join", null, SettingLevel.DEVICE, true);
|
||||
const { store, client, dispatcher } = await getRoomListStore();
|
||||
const room = new Room("!fooknock:matrix.org", client, client.getSafeUserId(), {});
|
||||
|
||||
room.getMyMembership = jest.fn().mockReturnValue(KnownMembership.Knock);
|
||||
dispatcher.dispatch(
|
||||
{
|
||||
action: "MatrixActions.Room.myMembership",
|
||||
membership: KnownMembership.Knock,
|
||||
room,
|
||||
},
|
||||
true,
|
||||
);
|
||||
expect(store.getSortedRoomsInActiveSpace([FilterKey.InvitesFilter]).rooms).not.toContain(room);
|
||||
|
||||
room.getMyMembership = jest.fn().mockReturnValue(KnownMembership.Invite);
|
||||
dispatcher.dispatch(
|
||||
{
|
||||
action: "MatrixActions.Room.myMembership",
|
||||
oldMembership: KnownMembership.Knock,
|
||||
membership: KnownMembership.Invite,
|
||||
room,
|
||||
},
|
||||
true,
|
||||
);
|
||||
expect(store.getSortedRoomsInActiveSpace([FilterKey.InvitesFilter]).rooms).toContain(room);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user