RoomList: add back Favourites and Low Priority filters when sections are disabled (#34162)

* Add back Favourites and Low Priority filter into shared components

* Wireup RoomList.showSections and filters in room list vm

* Add e2e test for filters and showSection setting
This commit is contained in:
Florian Duros
2026-07-09 10:25:45 +00:00
committed by GitHub
parent 707d5a4353
commit f21a3f5413
6 changed files with 155 additions and 2 deletions
@@ -129,6 +129,46 @@ test.describe("Room list sections", () => {
});
});
test.describe("Filters when sections are disabled", () => {
test.beforeEach(async ({ app }) => {
await app.settings.setValue("RoomList.showSections", null, SettingLevel.ACCOUNT, false);
// A favourite room, a low priority room, and a regular room.
const favouriteId = await app.client.createRoom({ name: "favourite room" });
await app.client.evaluate(async (client, roomId) => {
await client.setRoomTag(roomId, "m.favourite");
}, favouriteId);
const lowPrioId = await app.client.createRoom({ name: "low prio room" });
await app.client.evaluate(async (client, roomId) => {
await client.setRoomTag(roomId, "m.lowpriority");
}, lowPrioId);
await app.client.createRoom({ name: "regular room" });
});
test("shows the Favourites and Low Priority filters and filters the flat list", async ({ page }) => {
const roomList = getRoomList(page);
const primaryFilters = getPrimaryFilters(page);
// Expand the filter list to reveal all filters
await primaryFilters.getByRole("button", { name: "Expand filter list" }).click();
// The Favourites and Low Priority filters are available again when sections are disabled
await expect(primaryFilters.getByRole("option", { name: "Favourites" })).toBeVisible();
await expect(primaryFilters.getByRole("option", { name: "Low priority" })).toBeVisible();
// Filtering by Favourites shows only the favourite room
await primaryFilters.getByRole("option", { name: "Favourites" }).click();
await expect(roomList.getByRole("option", { name: "Open room favourite room" })).toBeVisible();
await expect(roomList.getByRole("option", { name: "Open room regular room" })).not.toBeVisible();
await expect(roomList.getByRole("option", { name: "Open room low prio room" })).not.toBeVisible();
// Switching to the Low Priority filter shows only the low priority room
await primaryFilters.getByRole("option", { name: "Low priority" }).click();
await expect(roomList.getByRole("option", { name: "Open room low prio room" })).toBeVisible();
await expect(roomList.getByRole("option", { name: "Open room favourite room" })).not.toBeVisible();
});
});
test.describe("Section collapse and expand", () => {
[
{ section: "Favourites", roomName: "favourite room", tag: "m.favourite" },