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 issues with implementation for MSC3981 #3448

Closed
wants to merge 7 commits into from

Conversation

justjanne
Copy link
Contributor

@justjanne justjanne commented Jun 6, 2023

Type: Defect
Uses: matrix-org/matrix-spec-proposals#3981
Uses: matrix-org/matrix-spec-proposals#4023
Related: #3248
Related: #3427

  1. Fixes an issue where messages discovered via recursive relations would not be accurately reported as belonging to the thread via eventShouldLiveIn. This was fixed by setting the unsigned thread id field for thread timeline pagination calls if it's not yet set by the server.
  2. Fixes an issue where reactions were not included in thread timelines. This was fixed by disabling the "only return m.thread events" filter on those calls if recursive relations is available.

Here's what your changelog entry will look like:

🐛 Bug Fixes

@justjanne justjanne marked this pull request as ready for review June 6, 2023 10:43
@justjanne justjanne requested a review from a team as a code owner June 6, 2023 10:43
@justjanne justjanne requested review from richvdh and artcodespace June 6, 2023 10:43
@@ -29,6 +29,7 @@ import {
PendingEventOrdering,
RelationType,
Room,
UNSIGNED_THREAD_ID_FIELD,
Copy link
Member

Choose a reason for hiding this comment

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

generally, I think that using constants like this in tests is an antipattern. It means that the tests don't help us spot typos or unexpected changes in the behaviour of the constant, and it makes the tests harder to grok.

It would be better just to hardcode org.matrix.msc4023.thread_id.

Comment on lines +63 to +65
if (client.canSupport.get(Feature.RelationsRecursion) === ServerSupport.Unstable) {
params = replaceParam("recurse", "org.matrix.msc3981.recurse", params);
}
Copy link
Member

Choose a reason for hiding this comment

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

this feels like a sledgehammer to crack a nut. Shouldn't the calling test know if we expect recurse or org.matrix.msc3981.recurse?

@@ -5774,6 +5776,10 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
...resOlder.chunk.map(mapper),
];
for (const event of events) {
event.setUnsigned({
...event.getUnsigned(),
[UNSIGNED_THREAD_ID_FIELD.name]: timelineSet.thread.id,
Copy link
Member

Choose a reason for hiding this comment

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

isn't this overriding the response from the server? Why are we doing that?

Comment on lines +1183 to +1185
unsigned: {
[UNSIGNED_THREAD_ID_FIELD.name]: THREAD_ROOT.event_id,
},
Copy link
Member

Choose a reason for hiding this comment

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

I'm somewhat concerned that by changing all these, we never test the fallback behaviour. Do we have any separate tests for the fallback? Do we actually need to change all these definitions?

@justjanne justjanne closed this Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants