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

Be tolerant of the the end key not existing in a /messages response #489

Merged
merged 1 commit into from
Oct 4, 2022

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Oct 4, 2022

Be tolerant of the the end key not existing in a /messages response. As spec'd:

If no further events are available (either because we have reached the start of the timeline, or because the user does not have permission to see any more events), this property is omitted from the response.

-- https://spec.matrix.org/v1.1/client-server-api/#get_matrixclientv3roomsroomidmessages

Split out from #214

Previously, it would throw the following error and potentially we found all of the events within that last response to satisfy everything,

JSONFieldStr: key 'end' missing

@MadLittleMods MadLittleMods requested review from a team as code owners October 4, 2022 23:10
Comment on lines +1297 to +1301
// Since this will throw an error if they key does not exist, do this at the end of
// the loop. It's a valid scenario to be at the end of the room and have no more to
// paginate so we want to make sure the `return` above runs when we've found all of
// the expected events.
messageResEnd = client.GetJSONFieldStr(t, messsageResBody, "end")
Copy link
Contributor Author

@MadLittleMods MadLittleMods Oct 4, 2022

Choose a reason for hiding this comment

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

I am guessing this might be some Synapse change since I haven't noticed this before (nothing obvious in the changelog) 🤔

But it is part of the spec:

If no further events are available (either because we have reached the start of the timeline, or because the user does not have permission to see any more events), this property is omitted from the response.

-- https://spec.matrix.org/v1.1/client-server-api/#get_matrixclientv3roomsroomidmessages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant