This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
Implement filtering for /roomId/messages #1809
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make
GET /_matrix/client/r0/rooms/{roomId}/messages
accept afilter
parameter inaccordance with the spec (hopefully).
Related issue: #587
This is my first PR to a matrix-project, so there are a couple of thing I'm unsure about:
Database.GetEventsInTopologicalRange
doesn't support filters, so if the client specifies atopological
from
-token filtering wont work. Not sure if this is intended.limit
can be set both as a query parameter, and as a part of RoomEventFilter.The spec doesn't seem to specify which takes precedence if both are specified.
For now I've assumed that the query parameter takes precedence.
Curiously, the default
limit
value ingomatrixserverlib.RoomEventFilter
is 20. I'm not sureif this is something I should adhere to, or event if it conforms to the spec, since the default for
the query parameter is 10.
Unlike
/sync
, the spec doesn't seem to allow for the filter payload to be afilter_id
instead of a JSON RoomEventFilter. Is this intended, or a spec oversight?
SyTest
Sadly, no new tests are passing (there doesn't seem to be many tests which handle filtering /messages),
although a couple of tests seem to be closer to passing than before:
Ephemeral messages received from clients are correctly expired
Ephemeral messages received from servers are correctly expired
These now fail for other reasons than filtering not working :)
Pull Request Checklist
sytest-whitelist
as specified in docs/sytest.mdSigned-off-by:
Joakim Hulthe <[email protected]>