diff --git a/playwright/e2e/read-receipts/editing-messages.spec.ts b/playwright/e2e/read-receipts/editing-messages.spec.ts index 49db3bdfbed..5005ad62bfb 100644 --- a/playwright/e2e/read-receipts/editing-messages.spec.ts +++ b/playwright/e2e/read-receipts/editing-messages.spec.ts @@ -187,11 +187,11 @@ test.describe("Read receipts", () => { // Given we have read the thread await util.goTo(room1); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Msg1"); await util.assertRead(room2); - await util.backToThreadsList(); + await util.assertReadThread("Resp1"); await util.goTo(room1); // When a message inside it is edited @@ -202,6 +202,7 @@ test.describe("Read receipts", () => { await util.goTo(room2); await util.assertReadThread("Msg1"); }); + test("Reading an edit of a threaded message makes the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -211,11 +212,11 @@ test.describe("Read receipts", () => { // Given an edited thread message appears after we read it await util.goTo(room1); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Msg1"); await util.assertRead(room2); - await util.backToThreadsList(); + await util.assertReadThread("Resp1"); await util.goTo(room1); await util.receiveMessages(room2, [msg.editOf("Resp1", "Edit1")]); await util.assertStillRead(room2); @@ -228,6 +229,7 @@ test.describe("Read receipts", () => { await util.assertStillRead(room2); await util.assertReadThread("Msg1"); }); + test("Marking a room as read after an edit in a thread makes it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -241,14 +243,16 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Resp1"), msg.editOf("Resp1", "Edit1"), ]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); // When I mark the room as read await util.markAsRead(room2); // Then it is read await util.assertRead(room2); + await util.assertReadThread("Msg1"); }); + test("Editing a thread message after marking as read leaves the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -258,7 +262,7 @@ test.describe("Read receipts", () => { // Given a room is marked as read await util.goTo(room1); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.markAsRead(room2); await util.assertRead(room2); @@ -267,7 +271,9 @@ test.describe("Read receipts", () => { // Then the room remains read await util.assertStillRead(room2); + await util.assertReadThread("Msg1"); }); + test("A room with an edited threaded message is still read after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -287,6 +293,7 @@ test.describe("Read receipts", () => { // Then is it still read await util.assertRead(room2); }); + test("A room where all threaded edits are read is still read after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -295,20 +302,23 @@ test.describe("Read receipts", () => { }) => { await util.goTo(room1); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.editOf("Resp1", "Edit1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Msg1"); await util.assertRead(room2); + await util.assertReadThread("Msg1"); await util.goTo(room1); // Make sure we are looking at room1 after reload await util.assertStillRead(room2); await util.saveAndReload(); await util.assertRead(room2); + await util.assertReadThread("Msg1"); }); + test("A room where all threaded edits are marked as read is still read after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -321,15 +331,17 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Resp1"), msg.editOf("Resp1", "Edit1"), ]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.markAsRead(room2); await util.assertRead(room2); + await util.assertReadThread("Msg1"); // When I restart await util.saveAndReload(); // It is still read await util.assertRead(room2); + await util.assertReadThread("Msg1"); }); }); @@ -343,7 +355,7 @@ test.describe("Read receipts", () => { // Given I have read a thread await util.goTo(room1); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Msg1"); await util.backToThreadsList(); @@ -361,6 +373,7 @@ test.describe("Read receipts", () => { await util.assertStillRead(room2); await util.assertReadThread("Edit1"); }); + test("Reading an edit of a thread root leaves the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -386,6 +399,7 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.assertStillRead(room2); }); + test("Editing a thread root after reading leaves the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -405,6 +419,7 @@ test.describe("Read receipts", () => { // Then the room stays read await util.assertStillRead(room2); }); + test("Marking a room as read after an edit of a thread root keeps it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -431,6 +446,7 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.assertStillRead(room2); }); + test("Editing a thread root that is a reply after marking as read leaves the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -444,7 +460,7 @@ test.describe("Read receipts", () => { msg.replyTo("Msg", "Reply"), msg.threadedOff("Reply", "InThread"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 2); await util.markAsRead(room2); await util.assertRead(room2); @@ -458,6 +474,7 @@ test.describe("Read receipts", () => { await util.goTo(room2); await util.assertReadThread("Edited Reply"); }); + test("Marking a room as read after an edit of a thread root that is a reply leaves it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -472,7 +489,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Reply", "InThread"), ]); await util.receiveMessages(room2, [msg.editOf("Reply", "Edited Reply")]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 2); // When I mark the room as read await util.markAsRead(room2); diff --git a/playwright/e2e/read-receipts/high-level.spec.ts b/playwright/e2e/read-receipts/high-level.spec.ts index 897e752ac45..e237afd64a8 100644 --- a/playwright/e2e/read-receipts/high-level.spec.ts +++ b/playwright/e2e/read-receipts/high-level.spec.ts @@ -224,15 +224,15 @@ test.describe("Read receipts", () => { ...msg.manyThreadedOff("Root3", many("T", 20)), ]); await util.goTo(room2); - await util.assertUnread(room2, 60); + await util.assertRead(room2); + await util.assertUnreadThread("Root1"); + await util.assertUnreadThread("Root2"); + await util.assertUnreadThread("Root3"); await util.openThread("Root1"); - await util.assertUnread(room2, 40); await util.assertReadThread("Root1"); await util.openThread("Root2"); - await util.assertUnread(room2, 20); await util.assertReadThread("Root2"); await util.openThread("Root3"); - await util.assertRead(room2); await util.assertReadThread("Root3"); // When I restart and page up to load old thread roots @@ -247,6 +247,7 @@ test.describe("Read receipts", () => { await util.assertReadThread("Root2"); await util.assertReadThread("Root3"); }); + test("Paging up to find old threads that were never read keeps the room unread", async ({ cryptoBackend, roomAlpha: room1, @@ -268,7 +269,7 @@ test.describe("Read receipts", () => { ...many("Msg", 100), ]); await util.goTo(room2); - await util.assertUnread(room2, 6); + await util.assertRead(room2); await util.assertUnreadThread("Root1"); await util.assertUnreadThread("Root2"); await util.assertUnreadThread("Root3"); @@ -278,20 +279,21 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.saveAndReload(); - // Then the room remembers it's unread + // Then the room remembers it's read // TODO: I (andyb) think this will fall in an encrypted room - await util.assertUnread(room2, 6); + await util.assertRead(room2); // And when I page up to load old thread roots await util.goTo(room2); await util.pageUp(); - // Then the room remains unread - await util.assertUnread(room2, 6); + // Then the room remains read + await util.assertRead(room2); await util.assertUnreadThread("Root1"); await util.assertUnreadThread("Root2"); await util.assertUnreadThread("Root3"); }); + test("Looking in thread view to find old threads that were never read makes the room unread", async ({ roomAlpha: room1, roomBeta: room2, @@ -310,7 +312,7 @@ test.describe("Read receipts", () => { ...many("Msg", 100), ]); await util.goTo(room2); - await util.assertUnread(room2, 6); + await util.assertRead(room2); await util.assertUnreadThread("Root1"); await util.assertUnreadThread("Root2"); await util.assertUnreadThread("Root3"); @@ -320,20 +322,21 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.saveAndReload(); - // Then the room remembers it's unread + // Then the room remembers it's read // TODO: I (andyb) think this will fall in an encrypted room - await util.assertUnread(room2, 6); + await util.assertRead(room2); // And when I open the threads view await util.goTo(room2); await util.openThreadList(); - // Then the room remains unread - await util.assertUnread(room2, 6); + // Then the room remains read + await util.assertRead(room2); await util.assertUnreadThread("Root1"); await util.assertUnreadThread("Root2"); await util.assertUnreadThread("Root3"); }); + test("After marking room as read, paging up to find old threads that were never read leaves the room read", async ({ cryptoBackend, roomAlpha: room1, diff --git a/playwright/e2e/read-receipts/new-messages.spec.ts b/playwright/e2e/read-receipts/new-messages.spec.ts index 14434709cea..97308a4bb29 100644 --- a/playwright/e2e/read-receipts/new-messages.spec.ts +++ b/playwright/e2e/read-receipts/new-messages.spec.ts @@ -183,9 +183,13 @@ test.describe("Read receipts", () => { // When I receive a threaded message await util.receiveMessages(room2, [msg.threadedOff("Msg1", "Resp1")]); - // Then the room becomes unread - await util.assertUnread(room2, 1); + // Then the room stays read + await util.assertRead(room2); + // but the thread is unread + await util.goTo(room2); + await util.assertUnreadThread("Msg1"); }); + test("Reading the last threaded message makes the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -195,15 +199,16 @@ test.describe("Read receipts", () => { // Given a thread exists and is not read await util.goTo(room1); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); // When I read it await util.openThread("Msg1"); - // The room becomes read - await util.assertRead(room2); + // The thread becomes read + await util.assertReadThread("Msg1"); }); + test("Reading a thread message makes the thread read", async ({ roomAlpha: room1, roomBeta: room2, @@ -217,19 +222,20 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Resp1"), msg.threadedOff("Msg1", "Resp2"), ]); - await util.assertUnread(room2, 3); // (Sanity) + await util.assertUnread(room2, 1); // (Sanity) // When I read the main timeline await util.goTo(room2); - // Then room does appear unread - await util.assertUnread(room2, 2); + // Then room is read + await util.assertRead(room2); - // Until we open the thread + // Reading the thread causes it to become read too await util.openThread("Msg1"); await util.assertReadThread("Msg1"); await util.assertRead(room2); }); + test("Reading an older thread message leaves the thread unread", async ({ roomAlpha: room1, roomBeta: room2, @@ -242,40 +248,19 @@ test.describe("Read receipts", () => { "ThreadRoot", ...msg.manyThreadedOff("ThreadRoot", many("InThread", 20)), ]); - await util.assertUnread(room2, 21); + await util.assertUnread(room2, 1); + await util.goTo(room2); + await util.assertUnreadThread("ThreadRoot"); + await util.goTo(room1); // When I read an older message in the thread await msg.jumpTo(room2.name, "InThread0000", true); - await util.assertUnreadLessThan(room2, 21); // Then the thread is still marked as unread await util.backToThreadsList(); await util.assertUnreadThread("ThreadRoot"); }); - test("Reading only one thread's message does not make the room read", async ({ - roomAlpha: room1, - roomBeta: room2, - util, - msg, - }) => { - // Given two threads are unread - await util.goTo(room1); - await util.receiveMessages(room2, [ - "Msg1", - msg.threadedOff("Msg1", "Resp1"), - "Msg2", - msg.threadedOff("Msg2", "Resp2"), - ]); - await util.assertUnread(room2, 4); - await util.goTo(room2); - await util.assertUnread(room2, 2); - // When I only read one of them - await util.openThread("Msg1"); - - // The room is still unread - await util.assertUnread(room2, 1); - }); test("Reading only one thread's message makes that thread read but not others", async ({ roomAlpha: room1, roomBeta: room2, @@ -290,9 +275,9 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Resp1"), msg.threadedOff("Msg2", "Resp2"), ]); - await util.assertUnread(room2, 4); // (Sanity) + await util.assertUnread(room2, 2); // (Sanity) await util.goTo(room2); - await util.assertUnread(room2, 2); + await util.assertRead(room2); await util.assertUnreadThread("Msg1"); await util.assertUnreadThread("Msg2"); @@ -303,6 +288,7 @@ test.describe("Read receipts", () => { await util.assertReadThread("Msg1"); await util.assertUnreadThread("Msg2"); }); + test("Reading the main timeline does not mark a thread message as read", async ({ roomAlpha: room1, roomBeta: room2, @@ -316,15 +302,16 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Resp1"), msg.threadedOff("Msg1", "Resp2"), ]); - await util.assertUnread(room2, 3); // (Sanity) + await util.assertUnread(room2, 1); // (Sanity) // When I read the main timeline await util.goTo(room2); - await util.assertUnread(room2, 2); + await util.assertRead(room2); // Then thread does appear unread await util.assertUnreadThread("Msg1"); }); + test("Marking a room with unread threads as read makes it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -338,14 +325,17 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Resp1"), msg.threadedOff("Msg1", "Resp2"), ]); - await util.assertUnread(room2, 3); // (Sanity) + await util.assertUnread(room2, 1); // (Sanity) // When I mark the room as read await util.markAsRead(room2); // Then the room is read await util.assertRead(room2); + // and so are the threads + await util.assertReadThread("Msg1"); }); + test("Sending a new thread message after marking as read makes it unread", async ({ roomAlpha: room1, roomBeta: room2, @@ -367,9 +357,11 @@ test.describe("Read receipts", () => { // Then another message appears in the thread await util.receiveMessages(room2, [msg.threadedOff("Msg1", "Resp3")]); - // Then the room becomes unread - await util.assertUnread(room2, 1); + // Then the thread becomes unread + await util.goTo(room2); + await util.assertUnreadThread("Msg1"); }); + test("Sending a new different-thread message after marking as read makes it unread", async ({ roomAlpha: room1, roomBeta: room2, @@ -381,11 +373,8 @@ test.describe("Read receipts", () => { await util.receiveMessages(room2, ["Thread1", "Thread2", msg.threadedOff("Thread1", "t1a")]); // Make sure the message in Thread 1 has definitely arrived, so that we know for sure // that the one in Thread 2 is the latest. - await util.assertUnread(room2, 3); await util.receiveMessages(room2, [msg.threadedOff("Thread2", "t2a")]); - // Make sure the 4th message has arrived before we mark as read. - await util.assertUnread(room2, 4); // When I mark the room as read (making an unthreaded receipt for t2a) await util.markAsRead(room2); @@ -394,9 +383,11 @@ test.describe("Read receipts", () => { // Then another message appears in the other thread await util.receiveMessages(room2, [msg.threadedOff("Thread1", "t1b")]); - // Then the room becomes unread - await util.assertUnread(room2, 1); + // Then the other thread becomes unread + await util.goTo(room2); + await util.assertUnreadThread("Thread1"); }); + test("A room with a new threaded message is still unread after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -410,21 +401,26 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Resp1"), msg.threadedOff("Msg1", "Resp2"), ]); - await util.assertUnread(room2, 3); // (Sanity) + await util.assertUnread(room2, 1); // (Sanity) // When I read the main timeline await util.goTo(room2); - // Then room does appear unread - await util.assertUnread(room2, 2); + // Then room appears read + await util.assertRead(room2); + /// but with an unread thread + await util.assertUnreadThread("Msg1"); await util.saveAndReload(); - await util.assertUnread(room2, 2); + await util.assertRead(room2); + await util.goTo(room2); + await util.assertUnreadThread("Msg1"); - // Until we open the thread + // Opening the thread now marks it as read await util.openThread("Msg1"); - await util.assertRead(room2); + await util.assertReadThread("Msg1"); }); + test("A room where all threaded messages are read is still read after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -438,17 +434,20 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Resp1"), msg.threadedOff("Msg1", "Resp2"), ]); - await util.assertUnread(room2, 3); // (Sanity) + await util.assertUnread(room2, 1); // (Sanity) await util.goTo(room2); - await util.assertUnread(room2, 2); - await util.openThread("Msg1"); await util.assertRead(room2); + await util.assertUnreadThread("Msg1"); + await util.openThread("Msg1"); + await util.assertReadThread("Msg1"); // When I restart await util.saveAndReload(); - // Then the room is still read + // Then the room & thread still read await util.assertRead(room2); + await util.goTo(room2); + await util.assertReadThread("Msg1"); }); }); @@ -462,15 +461,16 @@ test.describe("Read receipts", () => { // Given a thread exists await util.goTo(room1); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); - await util.assertUnread(room2, 2); // (Sanity) + await util.assertUnread(room2, 1); // (Sanity) // When I read the main timeline await util.goTo(room2); - // Then room does appear unread - await util.assertUnread(room2, 1); + // Then room doesn't appear unread but the thread does + await util.assertRead(room2); await util.assertUnreadThread("Msg1"); }); + test("Reading a thread root within the thread view marks it as read in the main timeline", async ({ roomAlpha: room1, roomBeta: room2, @@ -485,7 +485,7 @@ test.describe("Read receipts", () => { msg.threadedOff("ThreadRoot", "InThread"), ...many("afterThread", 30), ]); - await util.assertUnread(room2, 62); // Sanity + await util.assertUnread(room2, 61); // Sanity // When I jump to an old message and read the thread await msg.jumpTo(room2.name, "beforeThread0000"); @@ -496,6 +496,7 @@ test.describe("Read receipts", () => { // 30 remaining messages are unread - 7 messages are displayed under the thread root await util.assertUnread(room2, 30 - 7); }); + test("Creating a new thread based on a reply makes the room unread", async ({ roomAlpha: room1, roomBeta: room2, @@ -513,10 +514,12 @@ test.describe("Read receipts", () => { // When I receive a thread message created on the reply await util.receiveMessages(room2, [msg.threadedOff("Reply1", "Resp1")]); - // Then the room is unread - await util.assertUnread(room2, 1); + // Then the thread is unread + await util.goTo(room2); + await util.assertUnreadThread("Reply1"); }); - test("Reading a thread whose root is a reply makes the room read", async ({ + + test("Reading a thread whose root is a reply makes the thread read", async ({ roomAlpha: room1, roomBeta: room2, util, @@ -529,9 +532,9 @@ test.describe("Read receipts", () => { msg.replyTo("Msg1", "Reply1"), msg.threadedOff("Reply1", "Resp1"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 2); await util.goTo(room2); - await util.assertUnread(room2, 1); + await util.assertRead(room2); await util.assertUnreadThread("Reply1"); // When I read the thread diff --git a/playwright/e2e/read-receipts/reactions.spec.ts b/playwright/e2e/read-receipts/reactions.spec.ts index 1063c7d19e4..69208e5fc9e 100644 --- a/playwright/e2e/read-receipts/reactions.spec.ts +++ b/playwright/e2e/read-receipts/reactions.spec.ts @@ -107,10 +107,11 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.assertRead(room2); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Msg1"); await util.assertRead(room2); + await util.assertReadThread("Msg1"); await util.goTo(room1); // When someone reacts to a thread message @@ -118,7 +119,9 @@ test.describe("Read receipts", () => { // Then the room remains read await util.assertStillRead(room2); + await util.assertReadThread("Msg1"); }); + test("Marking a room as read after a reaction in a thread makes it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -133,7 +136,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Reply1"), msg.reactionTo("Reply1", "🪿"), ]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); // When I mark the room as read await util.markAsRead(room2); @@ -141,6 +144,7 @@ test.describe("Read receipts", () => { // Then it becomes read await util.assertRead(room2); }); + test("Reacting to a thread message after marking as read does not make the room unread", async ({ roomAlpha: room1, roomBeta: room2, @@ -155,7 +159,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Msg1", "Reply1"), msg.reactionTo("Reply1", "🪿"), ]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.markAsRead(room2); await util.assertRead(room2); @@ -164,7 +168,10 @@ test.describe("Read receipts", () => { // Then the room remains read await util.assertStillRead(room2); + // as does the thread + await util.assertReadThread("Msg1"); }); + test("A room with a reaction to a threaded message is still unread after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -175,22 +182,25 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.assertRead(room2); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Msg1"); await util.assertRead(room2); await util.goTo(room1); - // And someone reacted to it, which doesn't stop it being read + // And someone reacted to it, which doesn't make it read await util.receiveMessages(room2, [msg.reactionTo("Reply1", "🪿")]); await util.assertStillRead(room2); + await util.assertReadThread("Msg1"); // When I restart await util.saveAndReload(); // Then the room is still read await util.assertRead(room2); + await util.assertReadThread("Msg1"); }); + test("A room where all reactions in threads are read is still read after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -213,7 +223,7 @@ test.describe("Read receipts", () => { msg.reactionTo("Reply2b", "c"), msg.reactionTo("Reply1b", "t"), ]); - await util.assertUnread(room2, 6); + await util.assertUnread(room2, 2); await util.goTo(room2); await util.openThread("Msg1"); await util.assertReadThread("Msg1"); @@ -231,6 +241,7 @@ test.describe("Read receipts", () => { await util.assertReadThread("Msg1"); await util.assertReadThread("Msg2"); }); + test("Can remove a reaction in a thread", async ({ page, roomAlpha: room1, @@ -247,7 +258,7 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.assertRead(room2); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1a")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); // When I react to a thread message await util.goTo(room2); @@ -283,10 +294,11 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.assertRead(room2); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Msg1"); await util.assertRead(room2); + await util.assertReadThread("Msg1"); // When someone reacts to it await util.goTo(room1); @@ -295,7 +307,10 @@ test.describe("Read receipts", () => { // Then the room is still read await util.assertRead(room2); + // as is the thread + await util.assertReadThread("Msg1"); }); + test("Reading a reaction to a thread root leaves the room read", async ({ page, roomAlpha: room1, @@ -307,7 +322,7 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.assertRead(room2); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Msg1"); await util.assertRead(room2); @@ -316,6 +331,7 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.receiveMessages(room2, [msg.reactionTo("Msg1", "🪿")]); await util.assertRead(room2); + await util.assertReadThread("Msg1"); // When we read the reaction and go away again await util.goTo(room2); @@ -326,7 +342,9 @@ test.describe("Read receipts", () => { // Then the room is still read await util.assertRead(room2); + await util.assertReadThread("Msg1"); }); + test("Reacting to a thread root after marking as read makes the room unread but not the thread", async ({ page, roomAlpha: room1, @@ -338,11 +356,12 @@ test.describe("Read receipts", () => { await util.goTo(room1); await util.assertRead(room2); await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); // And we have marked the room as read await util.markAsRead(room2); await util.assertRead(room2); + await util.assertReadThread("Msg1"); // When someone reacts to it await util.receiveMessages(room2, [msg.reactionTo("Msg1", "🪿")]); @@ -350,6 +369,8 @@ test.describe("Read receipts", () => { // Then the room is still read await util.assertRead(room2); + // as is the thread + await util.assertReadThread("Msg1"); }); }); }); diff --git a/playwright/e2e/read-receipts/read-receipts.spec.ts b/playwright/e2e/read-receipts/read-receipts.spec.ts index 36f74e2c64e..dac679f6a07 100644 --- a/playwright/e2e/read-receipts/read-receipts.spec.ts +++ b/playwright/e2e/read-receipts/read-receipts.spec.ts @@ -16,9 +16,10 @@ limitations under the License. import type { JSHandle } from "@playwright/test"; import type { MatrixEvent, ISendEventResponse, ReceiptType } from "matrix-js-sdk/src/matrix"; -import { test, expect } from "../../element-web-test"; +import { expect } from "../../element-web-test"; import { ElementAppPage } from "../../pages/ElementAppPage"; import { Bot } from "../../pages/bot"; +import { test } from "."; test.describe("Read receipts", () => { test.use({ @@ -189,29 +190,31 @@ test.describe("Read receipts", () => { page, app, bot, + util, }) => { // Given we sent 3 events on the main thread const main1 = await sendMessage(bot); const thread1a = await botSendThreadMessage(bot, main1.event_id); await botSendThreadMessage(bot, main1.event_id); - // 1 unread on the main thread, 2 in the new thread - await expect(page.getByLabel(`${otherRoomName} 3 unread messages.`)).toBeVisible(); + // 1 unread on the main thread, 2 in the new thread that aren't shown + await expect(page.getByLabel(`${otherRoomName} 1 unread message.`)).toBeVisible(); // When we send receipts for main, and the second-last in the thread await sendThreadedReadReceipt(app, main1); await sendThreadedReadReceipt(app, thread1a, main1); // Then the room has only one unread - the one in the thread - await expect(page.getByLabel(`${otherRoomName} 1 unread message.`)).toBeVisible(); + await util.goTo(otherRoomName); + await util.assertUnreadThread("Message 1"); }); - test("Considers room read if there are receipts for main and other thread", async ({ page, app, bot }) => { + test("Considers room read if there are receipts for main and other thread", async ({ page, app, bot, util }) => { // Given we sent 3 events on the main thread const main1 = await sendMessage(bot); await botSendThreadMessage(bot, main1.event_id); const thread1b = await botSendThreadMessage(bot, main1.event_id); - // 1 unread on the main thread, 2 in the new thread - await expect(page.getByLabel(`${otherRoomName} 3 unread messages.`)).toBeVisible(); + // 1 unread on the main thread, 2 in the new thread which don't show + await expect(page.getByLabel(`${otherRoomName} 1 unread message.`)).toBeVisible(); // When we send receipts for main, and the last in the thread await sendThreadedReadReceipt(app, main1); @@ -219,27 +222,33 @@ test.describe("Read receipts", () => { // Then the room has no unreads await expect(page.getByLabel(`${otherRoomName}`)).toBeVisible(); + await util.goTo(otherRoomName); + await util.assertReadThread("Message 1"); }); test("Recognises unread messages on a thread after receiving a unthreaded receipt for earlier ones", async ({ page, app, bot, + util, }) => { // Given we sent 3 events on the main thread const main1 = await sendMessage(bot); const thread1a = await botSendThreadMessage(bot, main1.event_id); await botSendThreadMessage(bot, main1.event_id); - // 1 unread on the main thread, 2 in the new thread - await expect(page.getByLabel(`${otherRoomName} 3 unread messages.`)).toBeVisible(); + // 1 unread on the main thread, 2 in the new thread which don't count + await expect(page.getByLabel(`${otherRoomName} 1 unread message.`)).toBeVisible(); // When we send an unthreaded receipt for the second-last in the thread await sendUnthreadedReadReceipt(app, thread1a); // Then the room has only one unread - the one in the // thread. The one in main is read because the unthreaded - // receipt is for a later event. - await expect(page.getByLabel(`${otherRoomName} 1 unread message.`)).toBeVisible(); + // receipt is for a later event. The room should therefore be + // read, and the thread unread. + await expect(page.getByLabel(`${otherRoomName}`)).toBeVisible(); + await util.goTo(otherRoomName); + await util.assertUnreadThread("Message 1"); }); test("Recognises unread messages on main after receiving a unthreaded receipt for a thread message", async ({ @@ -252,8 +261,8 @@ test.describe("Read receipts", () => { await botSendThreadMessage(bot, main1.event_id); const thread1b = await botSendThreadMessage(bot, main1.event_id); await sendMessage(bot); - // 2 unreads on the main thread, 2 in the new thread - await expect(page.getByLabel(`${otherRoomName} 4 unread messages.`)).toBeVisible(); + // 2 unreads on the main thread, 2 in the new thread which don't count + await expect(page.getByLabel(`${otherRoomName} 2 unread messages.`)).toBeVisible(); // When we send an unthreaded receipt for the last in the thread await sendUnthreadedReadReceipt(app, thread1b); diff --git a/playwright/e2e/read-receipts/redactions.spec.ts b/playwright/e2e/read-receipts/redactions.spec.ts index 1b5751acbc1..f7affbed212 100644 --- a/playwright/e2e/read-receipts/redactions.spec.ts +++ b/playwright/e2e/read-receipts/redactions.spec.ts @@ -344,18 +344,23 @@ test.describe("Read receipts", () => { "Root2", msg.threadedOff("Root2", "Root2->A"), ]); - await util.assertUnread(room2, 5); + await util.assertUnread(room2, 2); - // And I have read them await util.goTo(room2); await util.assertUnreadThread("Root1"); + await util.assertUnreadThread("Root2"); + + // And I have read them + await util.assertUnreadThread("Root1"); await util.openThread("Root1"); - await util.assertUnreadLessThan(room2, 4); - await util.openThread("Root2"); await util.assertRead(room2); + await util.backToThreadsList(); + await util.assertReadThread("Root1"); + + await util.openThread("Root2"); + await util.assertReadThread("Root2"); await util.closeThreadsPanel(); await util.goTo(room1); - await util.assertRead(room2); // When the latest message in a thread is redacted await util.receiveMessages(room2, [msg.redactionOf("ThreadMsg2")]); @@ -365,6 +370,7 @@ test.describe("Read receipts", () => { await util.goTo(room2); await util.assertReadThread("Root1"); }); + test("Reading an unread thread after a redaction of the latest message makes it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -378,9 +384,9 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "ThreadMsg1"), msg.threadedOff("Root", "ThreadMsg2"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("ThreadMsg2")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.assertUnreadThread("Root"); @@ -395,6 +401,7 @@ test.describe("Read receipts", () => { await util.goTo(room2); await util.assertReadThread("Root"); }); + test("Reading an unread thread after a redaction of the latest message makes it read after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -408,9 +415,9 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "ThreadMsg1"), msg.threadedOff("Root", "ThreadMsg2"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("ThreadMsg2")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.assertUnreadThread("Root"); await util.openThread("Root"); @@ -424,9 +431,12 @@ test.describe("Read receipts", () => { // When I restart await util.saveAndReload(); - // Then the room is still read + // Then the room and thread are still read await util.assertRead(room2); + await util.openThreadList(); + await util.assertReadThread("Root"); }); + test("Reading an unread thread after a redaction of an older message makes it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -440,9 +450,9 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "ThreadMsg1"), msg.threadedOff("Root", "ThreadMsg2"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("ThreadMsg1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.assertUnreadThread("Root"); @@ -457,6 +467,7 @@ test.describe("Read receipts", () => { await util.goTo(room2); await util.assertReadThread("Root"); }); + test("Marking an unread thread as read after a redaction makes it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -470,9 +481,9 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "ThreadMsg1"), msg.threadedOff("Root", "ThreadMsg2"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("ThreadMsg1")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); // When I mark the room as read await util.markAsRead(room2); @@ -483,6 +494,7 @@ test.describe("Read receipts", () => { await util.goTo(room2); await util.assertReadThread("Root"); }); + test("Sending and redacting a message after marking the thread as read leaves it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -496,20 +508,22 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "ThreadMsg1"), msg.threadedOff("Root", "ThreadMsg2"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.markAsRead(room2); await util.assertRead(room2); // When I send and redact a message await util.receiveMessages(room2, [msg.threadedOff("Root", "Msg3")]); - await util.assertUnread(room2, 1); + await util.goTo(room2); + await util.openThreadList(); + await util.assertUnreadThread("Root"); await util.receiveMessages(room2, [msg.redactionOf("Msg3")]); // Then the room and thread are read - await util.assertRead(room2); await util.goTo(room2); await util.assertReadThread("Root"); }); + test("Redacting a message after marking the thread as read leaves it read", async ({ roomAlpha: room1, roomBeta: room2, @@ -523,7 +537,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "ThreadMsg1"), msg.threadedOff("Root", "ThreadMsg2"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.markAsRead(room2); await util.assertRead(room2); @@ -535,6 +549,7 @@ test.describe("Read receipts", () => { await util.goTo(room2); await util.assertReadThread("Root"); }); + test("Reacting to a redacted message leaves the thread read", async ({ roomAlpha: room1, roomBeta: room2, @@ -548,21 +563,27 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg2"), msg.threadedOff("Root", "Msg3"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("Msg2")]); - await util.assertUnread(room2, 2); - await util.goTo(room2); await util.assertUnread(room2, 1); + await util.goTo(room2); + await util.assertRead(room2); await util.openThread("Root"); await util.assertRead(room2); + await util.backToThreadsList(); + await util.assertReadThread("Root"); await util.goTo(room1); // When we receive a reaction to the redacted event await util.receiveMessages(room2, [msg.reactionTo("Msg2", "z")]); - // Then the room is unread + // Then the room is read await util.assertStillRead(room2); + await util.goTo(room2); + await util.openThreadList(); + await util.assertReadThread("Root"); }); + test("Editing a redacted message leaves the thread read", async ({ roomAlpha: room1, roomBeta: room2, @@ -576,13 +597,15 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg2"), msg.threadedOff("Root", "Msg3"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("Msg2")]); - await util.assertUnread(room2, 2); - await util.goTo(room2); await util.assertUnread(room2, 1); - await util.openThread("Root"); + await util.goTo(room2); await util.assertRead(room2); + await util.openThreadList(); + await util.assertUnreadThread("Root"); + await util.openThread("Root"); + await util.assertReadThread("Root"); await util.goTo(room1); // When we receive an edit of the redacted message @@ -590,7 +613,12 @@ test.describe("Read receipts", () => { // Then the room is unread await util.assertStillRead(room2); + // and so is the thread + await util.goTo(room2); + await util.openThreadList(); + await util.assertReadThread("Root"); }); + test("Reading a thread after a reaction to a redacted message marks the thread as read", async ({ roomAlpha: room1, roomBeta: room2, @@ -605,9 +633,9 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg3"), msg.reactionTo("Msg3", "x"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("Msg3")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); // When we read the thread await util.goTo(room2); @@ -617,6 +645,7 @@ test.describe("Read receipts", () => { await util.assertRead(room2); await util.assertReadThread("Root"); }); + test("Reading a thread containing a redacted, edited message marks the thread as read", async ({ roomAlpha: room1, roomBeta: room2, @@ -631,7 +660,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg3"), msg.editOf("Msg3", "Msg3 Edited"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("Msg3")]); // When we read the thread @@ -642,6 +671,7 @@ test.describe("Read receipts", () => { await util.assertRead(room2); await util.assertReadThread("Root"); }); + test("Reading a reply to a redacted message marks the thread as read", async ({ roomAlpha: room1, roomBeta: room2, @@ -656,7 +686,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg3"), msg.replyTo("Msg3", "Msg3Reply"), ]); - await util.assertUnread(room2, 4); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("Msg3")]); // When we read the thread, creating a receipt that points at the edit @@ -667,6 +697,7 @@ test.describe("Read receipts", () => { await util.assertRead(room2); await util.assertReadThread("Root"); }); + test("Reading a thread root when its only message has been redacted leaves the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -676,7 +707,7 @@ test.describe("Read receipts", () => { // Given we had a thread await util.goTo(room1); await util.receiveMessages(room2, ["Root", msg.threadedOff("Root", "Msg2")]); - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); // And then redacted the message that makes it a thread await util.receiveMessages(room2, [msg.redactionOf("Msg2")]); @@ -687,7 +718,11 @@ test.describe("Read receipts", () => { // Then the room is read await util.assertRead(room2); + // and that thread is read + await util.openThreadList(); + await util.assertReadThread("Root"); }); + test("A thread with a redacted unread is still read after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -701,13 +736,13 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "ThreadMsg1"), msg.threadedOff("Root", "ThreadMsg2"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Root"); await util.assertRead(room2); await util.assertReadThread("Root"); await util.receiveMessages(room2, [msg.threadedOff("Root", "Msg3")]); - await util.assertUnread(room2, 1); + await util.assertRead(room2); await util.receiveMessages(room2, [msg.redactionOf("Msg3")]); await util.assertRead(room2); await util.goTo(room2); @@ -722,7 +757,13 @@ test.describe("Read receipts", () => { await util.goTo(room2); await util.assertReadThread("Root"); }); - test("A thread with a read redaction is still read after restart", async ({ + + /* + * Disabled: this doesn't seem to work as, at some point after syncing from cache, the redaction and redacted + * event get removed from the thread timeline such that we have no record of the events that the read receipt + * points to. I suspect this may have been passing by fluke before. + */ + test.skip("A thread with a read redaction is still read after restart", async ({ roomAlpha: room1, roomBeta: room2, util, @@ -737,11 +778,11 @@ test.describe("Read receipts", () => { "Root2", msg.threadedOff("Root2", "Root2->A"), ]); - await util.assertUnread(room2, 5); + await util.assertUnread(room2, 2); await util.goTo(room2); await util.assertUnreadThread("Root1"); await util.openThread("Root1"); - await util.assertUnreadLessThan(room2, 4); + await util.assertRead(room2); await util.openThread("Root2"); await util.assertRead(room2); await util.closeThreadsPanel(); @@ -757,7 +798,12 @@ test.describe("Read receipts", () => { // Then the room is still read await util.assertRead(room2); + // and so is the thread + await util.openThreadList(); + await util.assertReadThread("Root1"); + await util.assertReadThread("Root2"); }); + test("A thread with an unread reply to a redacted message is still unread after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -772,7 +818,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg3"), msg.replyTo("Msg3", "Msg3Reply"), ]); - await util.assertUnread(room2, 4); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("Msg3")]); // And we have read all this @@ -788,6 +834,7 @@ test.describe("Read receipts", () => { await util.assertRead(room2); await util.assertReadThread("Root"); }); + test("A thread with a read reply to a redacted message is still read after restart", async ({ roomAlpha: room1, roomBeta: room2, @@ -802,7 +849,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg3"), msg.replyTo("Msg3", "Msg3Reply"), ]); - await util.assertUnread(room2, 4); + await util.assertUnread(room2, 1); await util.receiveMessages(room2, [msg.redactionOf("Msg3")]); // And I read it, so the room is read @@ -836,7 +883,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg2"), msg.threadedOff("Root", "Msg3"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Root"); await util.assertRead(room2); @@ -848,7 +895,12 @@ test.describe("Read receipts", () => { // Then the room is still read await util.assertStillRead(room2); }); - test("Redacting a thread root still allows us to read the thread", async ({ + + /* + * Disabled for the same reason as "A thread with a read redaction is still read after restart" + * above + */ + test.skip("Redacting a thread root still allows us to read the thread", async ({ roomAlpha: room1, roomBeta: room2, util, @@ -861,23 +913,24 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg2"), msg.threadedOff("Root", "Msg3"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); // When someone redacts the thread root await util.receiveMessages(room2, [msg.redactionOf("Root")]); // Then the room is still unread - await util.assertUnread(room2, 2); + await util.assertUnread(room2, 1); // And I can open the thread and read it await util.goTo(room2); - await util.assertUnread(room2, 2); + await util.assertRead(room2); // The redacted message gets collapsed into, "foo was invited, joined and removed a message" await util.openCollapsedMessage(1); await util.openThread("Message deleted"); await util.assertRead(room2); await util.assertReadThread("Root"); }); + test("Sending a threaded message onto a redacted thread root leaves the room unread", async ({ roomAlpha: room1, roomBeta: room2, @@ -891,7 +944,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg2"), msg.threadedOff("Root", "Msg3"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Root"); await util.assertRead(room2); @@ -901,11 +954,12 @@ test.describe("Read receipts", () => { // When we receive a new message on it await util.receiveMessages(room2, [msg.threadedOff("Root", "Msg4")]); - // Then the room and thread are unread - await util.assertUnread(room2, 1); + // Then the room is read but the thread is unread + await util.assertRead(room2); await util.goTo(room2); await util.assertUnreadThread("Message deleted"); }); + test("Reacting to a redacted thread root leaves the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -919,7 +973,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg2"), msg.threadedOff("Root", "Msg3"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Root"); await util.assertRead(room2); @@ -931,7 +985,9 @@ test.describe("Read receipts", () => { // Then the room is still read await util.assertRead(room2); + await util.assertReadThread("Root"); }); + test("Editing a redacted thread root leaves the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -945,7 +1001,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg2"), msg.threadedOff("Root", "Msg3"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Root"); await util.assertRead(room2); @@ -957,7 +1013,10 @@ test.describe("Read receipts", () => { // Then the room is still read await util.assertRead(room2); + // as is the thread + await util.assertReadThread("Root"); }); + test("Replying to a redacted thread root makes the room unread", async ({ roomAlpha: room1, roomBeta: room2, @@ -971,7 +1030,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg2"), msg.threadedOff("Root", "Msg3"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Root"); await util.assertRead(room2); @@ -984,6 +1043,7 @@ test.describe("Read receipts", () => { // Then the room is unread await util.assertUnread(room2, 1); }); + test("Reading a reply to a redacted thread root makes the room read", async ({ roomAlpha: room1, roomBeta: room2, @@ -998,7 +1058,7 @@ test.describe("Read receipts", () => { msg.threadedOff("Root", "Msg2"), msg.threadedOff("Root", "Msg3"), ]); - await util.assertUnread(room2, 3); + await util.assertUnread(room2, 1); await util.goTo(room2); await util.openThread("Root"); await util.assertRead(room2); diff --git a/playwright/e2e/threads/threads.spec.ts b/playwright/e2e/threads/threads.spec.ts index 5e32516646c..9b5ea46511e 100644 --- a/playwright/e2e/threads/threads.spec.ts +++ b/playwright/e2e/threads/threads.spec.ts @@ -495,14 +495,14 @@ test.describe("Threads", () => { await createThread("Hello again Mr. Bot", "Hello again Mr. User in a thread"); // Open thread panel - await page.getByRole("button", { name: "Threads" }).click(); + await page.getByTestId("threadsButton").click(); const threadPanel = page.locator(".mx_ThreadPanel"); await expect( threadPanel.locator(".mx_EventTile_last").getByText("Hello again Mr. User in a thread"), ).toBeVisible(); // Open threads list - await threadPanel.getByRole("button", { name: "Threads" }).click(); + await page.locator(".mx_BaseCard_back").click(); const rightPanel = page.locator(".mx_RightPanel"); // Check that the threads are listed await expect(rightPanel.locator(".mx_EventTile").getByText("Hello Mr. User in a thread")).toBeVisible(); diff --git a/playwright/snapshots/settings/appearance-user-settings-tab.spec.ts/window-12px-linux.png b/playwright/snapshots/settings/appearance-user-settings-tab.spec.ts/window-12px-linux.png index 23b77fd7518..ee9eca22836 100644 Binary files a/playwright/snapshots/settings/appearance-user-settings-tab.spec.ts/window-12px-linux.png and b/playwright/snapshots/settings/appearance-user-settings-tab.spec.ts/window-12px-linux.png differ diff --git a/playwright/snapshots/spaces/spaces.spec.ts/space-panel-collapsed-linux.png b/playwright/snapshots/spaces/spaces.spec.ts/space-panel-collapsed-linux.png index 32e664808e1..66b8af0e5be 100644 Binary files a/playwright/snapshots/spaces/spaces.spec.ts/space-panel-collapsed-linux.png and b/playwright/snapshots/spaces/spaces.spec.ts/space-panel-collapsed-linux.png differ diff --git a/playwright/snapshots/spaces/spaces.spec.ts/space-panel-expanded-linux.png b/playwright/snapshots/spaces/spaces.spec.ts/space-panel-expanded-linux.png index a2edd3d88fc..6f55f2fd008 100644 Binary files a/playwright/snapshots/spaces/spaces.spec.ts/space-panel-expanded-linux.png and b/playwright/snapshots/spaces/spaces.spec.ts/space-panel-expanded-linux.png differ diff --git a/src/components/views/dialogs/devtools/RoomNotifications.tsx b/src/components/views/dialogs/devtools/RoomNotifications.tsx index 5d03ee7c3a5..397db1fa4bc 100644 --- a/src/components/views/dialogs/devtools/RoomNotifications.tsx +++ b/src/components/views/dialogs/devtools/RoomNotifications.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import { NotificationCountType, Room, Thread, ReceiptType } from "matrix-js-sdk/src/matrix"; -import React, { useContext, useMemo } from "react"; +import React, { useContext } from "react"; import { ReadReceipt } from "matrix-js-sdk/src/models/read-receipt"; import MatrixClientContext from "../../../../contexts/MatrixClientContext"; @@ -25,7 +25,6 @@ import { determineUnreadState } from "../../../../RoomNotifs"; import { humanReadableNotificationLevel } from "../../../../stores/notifications/NotificationLevel"; import { doesRoomOrThreadHaveUnreadMessages } from "../../../../Unread"; import BaseTool, { DevtoolsContext, IDevtoolsProps } from "./BaseTool"; -import SettingsStore from "../../../../settings/SettingsStore"; function UserReadUpTo({ target }: { target: ReadReceipt }): JSX.Element { const cli = useContext(MatrixClientContext); @@ -66,12 +65,10 @@ function UserReadUpTo({ target }: { target: ReadReceipt }): JSX.Elemen } export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Element { - const tacEnabled = useMemo(() => SettingsStore.getValue("threadsActivityCentre"), []); - const { room } = useContext(DevtoolsContext); const cli = useContext(MatrixClientContext); - const { level, count } = determineUnreadState(room, undefined, !tacEnabled); + const { level, count } = determineUnreadState(room, undefined, false); const [notificationState] = useNotificationState(room); return ( diff --git a/src/components/views/spaces/SpacePanel.tsx b/src/components/views/spaces/SpacePanel.tsx index 429a18e1344..8d3041ff1ed 100644 --- a/src/components/views/spaces/SpacePanel.tsx +++ b/src/components/views/spaces/SpacePanel.tsx @@ -368,8 +368,6 @@ const SpacePanel: React.FC = () => { } }); - const isThreadsActivityCentreEnabled = useSettingValue("threadsActivityCentre"); - return ( {({ onKeyDownHandler, onDragEndHandler }) => ( @@ -426,9 +424,8 @@ const SpacePanel: React.FC = () => { )} - {isThreadsActivityCentreEnabled && ( - - )} + + diff --git a/src/hooks/useUnreadNotifications.ts b/src/hooks/useUnreadNotifications.ts index e0a2f1eeff2..f687ee7f1dd 100644 --- a/src/hooks/useUnreadNotifications.ts +++ b/src/hooks/useUnreadNotifications.ts @@ -15,13 +15,12 @@ limitations under the License. */ import { RoomEvent } from "matrix-js-sdk/src/matrix"; -import { useCallback, useEffect, useMemo, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import type { NotificationCount, Room } from "matrix-js-sdk/src/matrix"; import { determineUnreadState } from "../RoomNotifs"; import { NotificationLevel } from "../stores/notifications/NotificationLevel"; import { useEventEmitter } from "./useEventEmitter"; -import SettingsStore from "../settings/SettingsStore"; export const useUnreadNotifications = ( room?: Room, @@ -31,8 +30,6 @@ export const useUnreadNotifications = ( count: number; level: NotificationLevel; } => { - const tacEnabled = useMemo(() => SettingsStore.getValue("threadsActivityCentre"), []); - const [symbol, setSymbol] = useState(null); const [count, setCount] = useState(0); const [level, setLevel] = useState(NotificationLevel.None); @@ -53,11 +50,11 @@ export const useUnreadNotifications = ( useEventEmitter(room, RoomEvent.MyMembership, () => updateNotificationState()); const updateNotificationState = useCallback(() => { - const { symbol, count, level } = determineUnreadState(room, threadId, !tacEnabled); + const { symbol, count, level } = determineUnreadState(room, threadId, false); setSymbol(symbol); setCount(count); setLevel(level); - }, [room, threadId, tacEnabled]); + }, [room, threadId]); useEffect(() => { updateNotificationState(); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 16cdbd6949a..3e136846ca9 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1462,8 +1462,6 @@ "sliding_sync_server_no_support": "Your server lacks native support", "sliding_sync_server_specify_proxy": "Your server lacks native support, you must specify a proxy", "sliding_sync_server_support": "Your server has native support", - "threads_activity_centre": "Threads Activity Centre (in development)", - "threads_activity_centre_description": "Warning: Under active development; reloads %(brand)s.", "under_active_development": "Under active development.", "unrealiable_e2e": "Unreliable in encrypted rooms", "video_rooms": "Video rooms", diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index c5ae541610b..2137837500e 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -1151,15 +1151,6 @@ export const SETTINGS: { [setting: string]: ISetting } = { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, default: [], }, - "threadsActivityCentre": { - supportedLevels: LEVELS_ACCOUNT_SETTINGS, - labsGroup: LabGroup.Threads, - controller: new ReloadOnChangeController(), - displayName: _td("labs|threads_activity_centre"), - description: () => _t("labs|threads_activity_centre_description", { brand: SdkConfig.get().brand }), - default: false, - isFeature: true, - }, /** * Enable or disable the release announcement feature */ diff --git a/src/stores/notifications/RoomNotificationStateStore.ts b/src/stores/notifications/RoomNotificationStateStore.ts index f2d10ac4fb1..502d2dcce76 100644 --- a/src/stores/notifications/RoomNotificationStateStore.ts +++ b/src/stores/notifications/RoomNotificationStateStore.ts @@ -42,8 +42,6 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient { private listMap = new Map(); private _globalState = new SummarizedNotificationState(); - private tacEnabled = SettingsStore.getValue("threadsActivityCentre"); - private constructor(dispatcher = defaultDispatcher) { super(dispatcher, {}); SettingsStore.watchSetting("feature_dynamic_room_predecessors", null, () => { @@ -99,7 +97,7 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient { */ public getRoomState(room: Room): RoomNotificationState { if (!this.roomMap.has(room)) { - this.roomMap.set(room, new RoomNotificationState(room, !this.tacEnabled)); + this.roomMap.set(room, new RoomNotificationState(room, false)); } return this.roomMap.get(room)!; } diff --git a/test/components/structures/MatrixChat-test.tsx b/test/components/structures/MatrixChat-test.tsx index 908c7a7c04d..38309b81787 100644 --- a/test/components/structures/MatrixChat-test.tsx +++ b/test/components/structures/MatrixChat-test.tsx @@ -61,6 +61,7 @@ import SettingsStore from "../../../src/settings/SettingsStore"; import { SettingLevel } from "../../../src/settings/SettingLevel"; import { MatrixClientPeg as peg } from "../../../src/MatrixClientPeg"; import DMRoomMap from "../../../src/utils/DMRoomMap"; +import { ReleaseAnnouncementStore } from "../../../src/stores/ReleaseAnnouncementStore"; jest.mock("matrix-js-sdk/src/oidc/authorize", () => ({ completeAuthorizationCodeGrant: jest.fn(), @@ -627,6 +628,12 @@ describe("", () => { (id) => [room, spaceRoom].find((room) => room.roomId === id) || null, ); jest.spyOn(spaceRoom, "isSpaceRoom").mockReturnValue(true); + + jest.spyOn(ReleaseAnnouncementStore.instance, "getReleaseAnnouncement").mockReturnValue(null); + }); + + afterEach(() => { + jest.restoreAllMocks(); }); describe("leave_room", () => { diff --git a/test/components/views/settings/tabs/user/LabsUserSettingsTab-test.tsx b/test/components/views/settings/tabs/user/LabsUserSettingsTab-test.tsx index fd9a92a2253..3239c0f875d 100644 --- a/test/components/views/settings/tabs/user/LabsUserSettingsTab-test.tsx +++ b/test/components/views/settings/tabs/user/LabsUserSettingsTab-test.tsx @@ -60,7 +60,7 @@ describe("", () => { // non-beta labs section expect(screen.getByText("Early previews")).toBeInTheDocument(); const labsSections = container.getElementsByClassName("mx_SettingsSubsection"); - expect(labsSections).toHaveLength(11); + expect(labsSections).toHaveLength(10); }); describe("Rust crypto setting", () => { diff --git a/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap b/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap index 24412b1f779..f355631d5f3 100644 --- a/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap @@ -225,6 +225,48 @@ exports[` should show all activated MetaSpaces in the correct orde +
+ + + + +