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

Add more context for why threaded vs unthreaded read receipts #3378

Merged
merged 3 commits into from
May 24, 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
20 changes: 20 additions & 0 deletions src/receipt-accumulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,26 @@ export class ReceiptAccumulator {
eventId,
};

// In a world that supports threads, read receipts normally have
// a `thread_id` which is either the thread they belong in or
// `MAIN_ROOM_TIMELINE`, so we normally use `setThreaded(...)`
// here. The `MAIN_ROOM_TIMELINE` is just treated as another
// thread.
//
// We still encounter read receipts that are "unthreaded"
// (missing the `thread_id` property). These come from clients
// that don't support threads, and from threaded clients that
// are doing a "Mark room as read" operation. Unthreaded
// receipts mark everything "before" them as read, in all
// threads, where "before" means in Sync Order i.e. the order
// the events were received from the homeserver in a sync.
// [Note: we have some bugs where we use timestamp order instead
// of Sync Order, because we don't correctly remember the Sync
// Order. See #3325.]
//
// Calling the wrong method will cause incorrect behavior like
// messages re-appearing as "new" when you already read them
// previously.
MadLittleMods marked this conversation as resolved.
Show resolved Hide resolved
if (!data.thread_id) {
this.setUnthreaded(userId, receipt);
} else {
Expand Down