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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accumulate receipts for the main thread and unthreaded separately #3339

Merged
merged 1 commit into from May 2, 2023

Conversation

andybalaam
Copy link
Contributor

@andybalaam andybalaam commented May 2, 2023

Fixes element-hq/element-web#24629


Here's what your changelog entry will look like:

馃悰 Bug Fixes

@andybalaam andybalaam added the T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems label May 2, 2023
@andybalaam andybalaam marked this pull request as ready for review May 2, 2023 14:20
@andybalaam andybalaam requested a review from a team as a code owner May 2, 2023 14:20
Copy link
Contributor

@germain-gg germain-gg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃殌 馃挴 Looks great, thank you for working on this

@andybalaam andybalaam added this pull request to the merge queue May 2, 2023
Merged via the queue into develop with commit ee2f1cd May 2, 2023
33 checks passed
@andybalaam andybalaam deleted the andybalaam/accumulate-unthreaded-separately branch May 2, 2023 16:26
@@ -118,7 +118,7 @@ export class ReceiptAccumulator {
eventId,
};

if (!data.thread_id || data.thread_id === MAIN_ROOM_TIMELINE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment with some context would be helpful why "we shouldn't also be checking for MAIN_ROOM_TIMELINE because ... otherwise we run into bug x. We want to avoid making messages unread after ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, but basically the old code used to treat the main thread as special, and the fix is not to, so it felt like the comment should have been there before, and my change would have deleted it...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAIN_ROOM_TIMELINE is still a thing in the codebase that people need to reason about and I'm confused and have to think about whenever I look at it.

  • A normal message is part of thread_id = MAIN_ROOM_TIMELINE
  • A thread root is part of thread_id = MAIN_ROOM_TIMELINE
  • A threaded reply has a thread_id = 'xxx'

Perhaps we can add this in a comment somewhere:

In a world that supports threads, all read receipts have a thread_id which is either the thread they belong in or MAIN_ROOM_TIMELINE and we should always use setThreaded(...) here. The MAIN_ROOM_TIMELINE is just treated as another thread.

People still may send us read receipts from clients that don't support threads (unthreaded, without the thread_id property) which we use setUnthreaded(...) for.

Using the wrong method will cause undefined behavior like messages re-appearing as "new" when you already read them previously.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not quite it - when the user marks a room as read e.g. by pressing Esc or clicking the "x" in the top right, we do send an unthreaded receipt. I'd happily merge a PR from you with a comment like this somewhere appropriate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #3378 and incorporated those caveats 馃憤

andybalaam pushed a commit that referenced this pull request May 24, 2023
* Add more context for why threaded vs unthreaded read receipts

See #3339 (comment)

* Language updates from Andy

See #3378 (comment)

* Fix lints
su-ex added a commit to SchildiChat/matrix-js-sdk that referenced this pull request Dec 13, 2023
* Ensure we do not add relations to the wrong timeline ([\matrix-org#3427](matrix-org#3427)). Fixes element-hq/element-web#25450 and element-hq/element-web#25494.
* Deprecate `QrCodeEvent`, `SasEvent` and `VerificationEvent` ([\matrix-org#3386](matrix-org#3386)).
* Move crypto classes into a separate namespace ([\matrix-org#3385](matrix-org#3385)).
* Mention deno support in the README ([\matrix-org#3417](matrix-org#3417)). Contributed by @sigmaSd.
* Mark room version 10 as safe ([\matrix-org#3425](matrix-org#3425)).
* Prioritise entirely supported flows for UIA ([\matrix-org#3402](matrix-org#3402)).
* Add methods to terminate idb worker ([\matrix-org#3362](matrix-org#3362)).
* Total summary count ([\matrix-org#3351](matrix-org#3351)). Contributed by @toger5.
* Audio concealment ([\matrix-org#3349](matrix-org#3349)). Contributed by @toger5.
* Correctly accumulate sync summaries. ([\matrix-org#3366](matrix-org#3366)). Fixes element-hq/element-web#23345.
* Keep measuring a call feed's volume after a stream replacement ([\matrix-org#3361](matrix-org#3361)). Fixes element-hq/element-call#1051.
* Element-R: Avoid uploading a new fallback key at every `/sync` ([\matrix-org#3338](matrix-org#3338)). Fixes element-hq/element-web#25215.
* Accumulate receipts for the main thread and unthreaded separately ([\matrix-org#3339](matrix-org#3339)). Fixes element-hq/element-web#24629.
* Remove spec non-compliant extended glob format ([\matrix-org#3423](matrix-org#3423)). Fixes element-hq/element-web#25474.
* Fix bug where original event was inserted into timeline instead of the edit event ([\matrix-org#3398](matrix-org#3398)). Contributed by @andybalaam.
* Only add a local receipt if it's after an existing receipt ([\matrix-org#3399](matrix-org#3399)). Contributed by @andybalaam.
* Attempt a potential workaround for stuck notifs ([\matrix-org#3384](matrix-org#3384)). Fixes element-hq/element-web#25406. Contributed by @andybalaam.
* Fix verification bug with `pendingEventOrdering: "chronological"` ([\matrix-org#3382](matrix-org#3382)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read messages reappear as "new" after restarting the app.
3 participants