From 8dacc0213d639fa52ed6404906cddc6fe50195b6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 8 Sep 2022 16:16:51 +0100 Subject: [PATCH 1/3] Prevent sliding sync from showing a room under multiple sublists --- src/stores/room-list/SlidingRoomListStore.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stores/room-list/SlidingRoomListStore.ts b/src/stores/room-list/SlidingRoomListStore.ts index ccf4946886d..b8ba48659f1 100644 --- a/src/stores/room-list/SlidingRoomListStore.ts +++ b/src/stores/room-list/SlidingRoomListStore.ts @@ -55,6 +55,8 @@ const filterConditions: Record = { is_dm: true, is_invite: false, is_tombstoned: false, + // If a DM has a Favourite & Low Prio tag then it'll be shown in those lists instead + not_tags: ["m.favourite", "m.lowpriority"], }, [DefaultTagID.Untagged]: { is_dm: false, @@ -66,6 +68,8 @@ const filterConditions: Record = { }, [DefaultTagID.LowPriority]: { tags: ["m.lowpriority"], + // If a room has both Favourite & Low Prio tags then it'll be shown under Favourites + not_tags: ["m.favourite"], is_tombstoned: false, }, // TODO https://github.com/vector-im/element-web/issues/23207 From 2e5dc696a139e75d7fe84b9ae105c592712d6a15 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 8 Sep 2022 18:13:03 +0100 Subject: [PATCH 2/3] Add tests (cherry picked from commit 96656e4e1762c08c324888eac6f065c509f193d6) --- cypress/e2e/sliding-sync/sliding-sync.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cypress/e2e/sliding-sync/sliding-sync.ts b/cypress/e2e/sliding-sync/sliding-sync.ts index 5b5ec5145e0..8f4e42be25b 100644 --- a/cypress/e2e/sliding-sync/sliding-sync.ts +++ b/cypress/e2e/sliding-sync/sliding-sync.ts @@ -319,4 +319,18 @@ describe("Sliding Sync", () => { "Join", "Test Room", ]); }); + + it("should show a favourite DM only in the favourite sublist", () => { + cy.createRoom({ + name: "Favourite DM", + is_direct: true, + }).as("room").then(roomId => { + cy.contains(".mx_RoomSublist", "Apple"); + + cy.getClient().then(cli => cli.setRoomTag(roomId, "m.favourite", { order: 0.5 })); + }); + + cy.get('.mx_RoomSublist[aria-label="Favourites"]').contains(".mx_RoomTile", "Favourite DM").should("exist"); + cy.get('.mx_RoomSublist[aria-label="People"]').contains(".mx_RoomTile", "Favourite DM").should("not.exist"); + }); }); From 4abca7c30908eb2a394c533fe361fb2db2b4eb61 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 12 Sep 2022 16:56:42 +0100 Subject: [PATCH 3/3] Update sliding-sync.ts --- cypress/e2e/sliding-sync/sliding-sync.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/cypress/e2e/sliding-sync/sliding-sync.ts b/cypress/e2e/sliding-sync/sliding-sync.ts index 8f4e42be25b..80e20c51d8e 100644 --- a/cypress/e2e/sliding-sync/sliding-sync.ts +++ b/cypress/e2e/sliding-sync/sliding-sync.ts @@ -325,8 +325,6 @@ describe("Sliding Sync", () => { name: "Favourite DM", is_direct: true, }).as("room").then(roomId => { - cy.contains(".mx_RoomSublist", "Apple"); - cy.getClient().then(cli => cli.setRoomTag(roomId, "m.favourite", { order: 0.5 })); });