Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Events related to the root event of a thread cannot have read receipts sent on them #14168

Closed
clokep opened this issue Oct 13, 2022 · 2 comments · Fixed by #14174
Closed

Events related to the root event of a thread cannot have read receipts sent on them #14168

clokep opened this issue Oct 13, 2022 · 2 comments · Fixed by #14174
Assignees
Labels
A-Threads Threaded messages O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@clokep
Copy link
Member

clokep commented Oct 13, 2022

Originally reported at element-hq/element-web#23451, info from @gsouquet.

If you have a DAG that looks something like this:

flowchart RL
    E-->D
    D-->C
    C-->B
    B-->A
    B-.->|m.thread|A
    C-.->|m.thread|A
    D-.->|m.edit|C
    E-.->|m.reaction|A
Loading

The root event (and any other reactions, etc. to it) are shown both in the "main" timeline and as part of the thread. It is desirable for clients to be able to send a receipt in either of those. E.g. looking at a "thread" which shows A (as the root) and the reaction to it (E) and are trying to send a receipt for E.

@clokep
Copy link
Member Author

clokep commented Oct 13, 2022

I think we could probably (implementation-wise) allow a receipt for E to apply to either the main timeline or the A timeline iff there is at least one threaded reply to A. This makes the logic a little more complicated though (you're searching both up and down a tree instead of just up it). Will need to think about if that makes sense.

I think this would even be allowed by the spec (annotations added):

An event is considered to be “in a thread” if it meets any of the following criteria:

  • It has a rel_type of m.thread. <-- Obviously false in this case.
  • It has child events with a rel_type of m.thread (in which case it’d be the thread root). <-- False in all cases of something with a relationship.
  • Following the event relationships, it has a parent event which qualifies for one of the above. <-- This is TRUE; it has a parent event which has child events of rel_type of m.thread!

@clokep
Copy link
Member Author

clokep commented Oct 13, 2022

There are two cases which would be unaligned by making this change though:

Case 1 (which we're talking of changing):

Clients want to be able to send a receipt for an event related to the root event (via a non-thread relation).

Case 2:

Clients expect notifications from events related to the root event (via a non-thread relation) to be in that thread.


Note that the spec for notifications says:

To determine if an event is part of a thread the server follows the event relationship until it finds a thread root (as specified by the threading module), however it is not recommended that the server traverse infinitely. Instead, implementations are encouraged to do a maximum of 3 hops to find a thread before deciding that the event does not belong to a thread.

The threading module only talks about:

Threads are established using a rel_type of m.thread and reference the thread root (the first event in a thread).


From the above (and the comment above it sounds like the way events are considered part of a thread does differ for notifications vs. receipts.

@clokep clokep added S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. A-Threads Threaded messages O-Occasional Affects or can be seen by some users regularly or most users rarely labels Oct 13, 2022
@clokep clokep self-assigned this Oct 13, 2022
@clokep clokep linked a pull request Oct 13, 2022 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Threads Threaded messages O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant