From b30b340b43e8c3e1c7c0fa5c0dd5fee1e564cad0 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 16 Feb 2022 07:21:12 +0100 Subject: [PATCH] fix: hasNewMessage true when last event is sent --- lib/src/room.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/room.dart b/lib/src/room.dart index 02a59c3e..f1142d18 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -524,12 +524,15 @@ class Room { return false; } + // If the last event is sent, we mark the room as read. + if (lastEvent.senderId == client.userID) return false; + + // Get the timestamp of read marker and compare final readAtMilliseconds = roomAccountData['m.receipt'] ?.content .tryGetMap(client.userID!) ?.tryGet('ts') ?? 0; - return readAtMilliseconds < lastEvent.originServerTs.millisecondsSinceEpoch; }