Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain why synthetic receipts don't mark the room as read #3715

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/models/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2947,11 +2947,17 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {

// If the read receipt sent for the logged in user matches
// the last event of the live timeline, then we know for a fact
// that the user has read that message.
// We can mark the room as read and not wait for the local echo
// from synapse
// that the user has read that message, so we can mark the room
// as read and not wait for the remote echo from synapse.
//
// This needs to be done after the initial sync as we do not want this
// logic to run whilst the room is being initialised
//
// We only do this for non-synthetic receipts, because
// our intention is to do this when the user really did
// just read a message, not when we are e.g. receiving
// an event during the sync. More explanation at:
// https://github.com/matrix-org/matrix-js-sdk/issues/3684
if (!synthetic && this.client.isInitialSyncComplete() && userId === this.client.getUserId()) {
const lastEvent = receiptDestination.timeline[receiptDestination.timeline.length - 1];
if (lastEvent && eventId === lastEvent.getId() && userId === lastEvent.getSender()) {
Expand Down
Loading