Skip to content

Commit

Permalink
Add more context for why threaded vs unthreaded read receipts (#3378)
Browse files Browse the repository at this point in the history
* Add more context for why threaded vs unthreaded read receipts

See #3339 (comment)

* Language updates from Andy

See #3378 (comment)

* Fix lints
  • Loading branch information
MadLittleMods committed May 24, 2023
1 parent 729f924 commit ed71cde
Showing 1 changed file with 20 additions and 0 deletions.
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.
if (!data.thread_id) {
this.setUnthreaded(userId, receipt);
} else {
Expand Down

0 comments on commit ed71cde

Please sign in to comment.