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

Fix read receipt sending behaviour around thread roots #3600

Merged
merged 2 commits into from
Jul 13, 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
4 changes: 3 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5000,9 +5000,11 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
});

if (!unthreaded) {
const isThread = !!event.threadRootId;
// A thread cannot be just a thread root and a thread root can only be read in the main timeline
const isThread = !!event.threadRootId && !event.isThreadRoot;
Comment on lines +5003 to +5004
Copy link
Contributor

@MadLittleMods MadLittleMods Jul 12, 2023

Choose a reason for hiding this comment

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

I think it might be nice if we had a event.isThreadReply boolean that handled this complexity in a single place. We probably make this same mistake in other places.

Copy link
Member Author

Choose a reason for hiding this comment

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

We do, isRelation(RelationType.Thread) but that doesn't include 2nd order relations which we do want to include here. Reactions to thread responses aren't "thread replies" yet still want RRs

Copy link
Contributor

Choose a reason for hiding this comment

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

Whatever we want to call this logic !!event.threadRootId && !event.isThreadRoot; feels like it could be nicely encapsulated with a description of the intracies.

"thread replies" still feels applicable and a good enough name for reactions in this scenario but if there is a better name, that would be nice. I don't know how reactions to a thread root exactly works though. And those kind of details could be nicely explained there.

body = {
...body,
// Only thread replies should define a specific thread. Thread roots can only be read in the main timeline.
thread_id: isThread ? event.threadRootId : MAIN_ROOM_TIMELINE,
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
};
}
Expand Down
Loading