forked from Henry-Hiles/nexus
Fix read receipts sometimes not correctly applying
This commit is contained in:
parent
f8e64ea284
commit
1bd5f28c6d
1 changed files with 7 additions and 3 deletions
|
|
@ -201,11 +201,15 @@ class ClientController extends AsyncNotifier<int> {
|
||||||
_sendCommand("report_event", report.toJson());
|
_sendCommand("report_event", report.toJson());
|
||||||
|
|
||||||
Future<void> markRead(Room room) async {
|
Future<void> markRead(Room room) async {
|
||||||
if (room.events.isEmpty || room.metadata == null) return;
|
final event = room.events.firstWhereOrNull(
|
||||||
|
(event) => event.rowId == room.timeline.last.eventRowId,
|
||||||
|
);
|
||||||
|
if (event == null || room.metadata == null) return;
|
||||||
|
|
||||||
await _sendCommand("mark_read", {
|
await _sendCommand("mark_read", {
|
||||||
"room_id": room.metadata?.id,
|
"room_id": room.metadata!.id,
|
||||||
"receipt_type": "m.read",
|
"receipt_type": "m.read",
|
||||||
"event_id": room.events.last.eventId,
|
"event_id": event.eventId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue