mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-07 15:08:24 +00:00
RoomListStore: Support specific sorting requirements for muted rooms (#29665)
* Sort muted rooms to the bottom of the room list * Re-insert room on mute/unmute * Write tests * Fix broken playwright test Muted rooms are at the bottom, so we need to scroll.
This commit is contained in:
@@ -9,6 +9,7 @@ import { shuffle } from "lodash";
|
||||
|
||||
import type { Room } from "matrix-js-sdk/src/matrix";
|
||||
import type { Sorter } from "../../../../../src/stores/room-list-v3/skip-list/sorters";
|
||||
import type { RoomNotificationState } from "../../../../../src/stores/notifications/RoomNotificationState";
|
||||
import { mkMessage, stubClient } from "../../../../test-utils";
|
||||
import { RoomSkipList } from "../../../../../src/stores/room-list-v3/skip-list/RoomSkipList";
|
||||
import { RecencySorter } from "../../../../../src/stores/room-list-v3/skip-list/sorters/RecencySorter";
|
||||
@@ -16,6 +17,7 @@ import { AlphabeticSorter } from "../../../../../src/stores/room-list-v3/skip-li
|
||||
import { getMockedRooms } from "./getMockedRooms";
|
||||
import SpaceStore from "../../../../../src/stores/spaces/SpaceStore";
|
||||
import { MetaSpace } from "../../../../../src/stores/spaces";
|
||||
import { RoomNotificationStateStore } from "../../../../../src/stores/notifications/RoomNotificationStateStore";
|
||||
|
||||
describe("RoomSkipList", () => {
|
||||
function generateSkipList(roomCount?: number): {
|
||||
@@ -36,6 +38,12 @@ describe("RoomSkipList", () => {
|
||||
jest.spyOn(SpaceStore.instance, "isRoomInSpace").mockImplementation((space) => space === MetaSpace.Home);
|
||||
jest.spyOn(SpaceStore.instance, "activeSpace", "get").mockImplementation(() => MetaSpace.Home);
|
||||
jest.spyOn(SpaceStore.instance, "storeReadyPromise", "get").mockImplementation(() => Promise.resolve());
|
||||
jest.spyOn(RoomNotificationStateStore.instance, "getRoomState").mockImplementation(() => {
|
||||
const state = {
|
||||
mute: false,
|
||||
} as unknown as RoomNotificationState;
|
||||
return state;
|
||||
});
|
||||
});
|
||||
|
||||
it("Rooms are in sorted order after initial seed", () => {
|
||||
|
||||
Reference in New Issue
Block a user