From feea80dfd5aeb97cc7e3588c564d48f5cd2f2f8a Mon Sep 17 00:00:00 2001 From: Germain Date: Fri, 17 Dec 2021 07:32:10 +0000 Subject: [PATCH] Do not assume unread state if read receipt comes from a thread (#7368) --- src/Unread.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Unread.ts b/src/Unread.ts index da5b883f92..905798eb03 100644 --- a/src/Unread.ts +++ b/src/Unread.ts @@ -67,6 +67,15 @@ export function doesRoomHaveUnreadMessages(room: Room): boolean { return false; } + // if the read receipt relates to an event is that part of a thread + // we consider that there are no unread messages + // This might be a false negative, but probably the best we can do until + // the read receipts have evolved to cater for threads + const event = room.findEventById(readUpToId); + if (event?.getThread()) { + return false; + } + // this just looks at whatever history we have, which if we've only just started // up probably won't be very much, so if the last couple of events are ones that // don't count, we don't know if there are any events that do count between where