Room list: remove unused sorting ManualAlgorithm (#32724)

* chore: remove unused `ManualAlgorithm`

In the old room list ui, we can"t manually sort the rooms or the
sections. Neither in a menu or by drag and drop

* fix: add `undefined` to `tagRoom` signature since the code allows it

* test: add tests to `RoomListActions`

* chore: remuve unuseful comment

* refactor: remove unused ``newIndex

* doc: remove typing in tsdoc
This commit is contained in:
Florian Duros
2026-03-09 09:52:52 +00:00
committed by GitHub
parent 00dd0c48ba
commit 3e77974fa0
11 changed files with 205 additions and 167 deletions
@@ -88,72 +88,6 @@ describe("ImportanceAlgorithm", () => {
return algorithm;
};
describe("When sortAlgorithm is manual", () => {
const sortAlgorithm = SortAlgorithm.Manual;
it("orders rooms by tag order without categorizing", () => {
jest.spyOn(RoomNotificationStateStore.instance, "getRoomState");
const algorithm = setupAlgorithm(sortAlgorithm);
// didn't check notif state
expect(RoomNotificationStateStore.instance.getRoomState).not.toHaveBeenCalled();
// sorted according to room tag order
expect(algorithm.orderedRooms).toEqual([roomC, roomA, roomB]);
});
describe("handleRoomUpdate", () => {
// XXX: This doesn't work because manual ordered rooms dont get categoryindices
// possibly related https://github.com/vector-im/element-web/issues/25099
it.skip("removes a room", () => {
const algorithm = setupAlgorithm(sortAlgorithm);
const shouldTriggerUpdate = algorithm.handleRoomUpdate(roomA, RoomUpdateCause.RoomRemoved);
expect(shouldTriggerUpdate).toBe(true);
expect(algorithm.orderedRooms).toEqual([roomC, roomB]);
});
// XXX: This doesn't work because manual ordered rooms dont get categoryindices
it.skip("adds a new room", () => {
const algorithm = setupAlgorithm(sortAlgorithm);
const shouldTriggerUpdate = algorithm.handleRoomUpdate(roomD, RoomUpdateCause.NewRoom);
expect(shouldTriggerUpdate).toBe(true);
expect(algorithm.orderedRooms).toEqual([roomC, roomB, roomD, roomE]);
});
it("does nothing and returns false for a timeline update", () => {
const algorithm = setupAlgorithm(sortAlgorithm);
const beforeRooms = algorithm.orderedRooms;
const shouldTriggerUpdate = algorithm.handleRoomUpdate(roomA, RoomUpdateCause.Timeline);
expect(shouldTriggerUpdate).toBe(false);
// strict equal
expect(algorithm.orderedRooms).toBe(beforeRooms);
});
it("does nothing and returns false for a read receipt update", () => {
const algorithm = setupAlgorithm(sortAlgorithm);
const beforeRooms = algorithm.orderedRooms;
const shouldTriggerUpdate = algorithm.handleRoomUpdate(roomA, RoomUpdateCause.ReadReceipt);
expect(shouldTriggerUpdate).toBe(false);
// strict equal
expect(algorithm.orderedRooms).toBe(beforeRooms);
});
it("throws for an unhandle update cause", () => {
const algorithm = setupAlgorithm(sortAlgorithm);
expect(() =>
algorithm.handleRoomUpdate(roomA, "something unexpected" as unknown as RoomUpdateCause),
).toThrow("Unsupported update cause: something unexpected");
});
});
});
describe("When sortAlgorithm is alphabetical", () => {
const sortAlgorithm = SortAlgorithm.Alphabetic;