fix: hasNewMessage true when last event is sent

This commit is contained in:
Christian Pauly 2022-02-16 07:21:12 +01:00
parent d543a0314d
commit b30b340b43
1 changed files with 4 additions and 1 deletions

View File

@ -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<String, dynamic>(client.userID!)
?.tryGet<int>('ts') ??
0;
return readAtMilliseconds < lastEvent.originServerTs.millisecondsSinceEpoch;
}