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

Commit

Permalink
Filter events_before and events_after in /context requests
Browse files Browse the repository at this point in the history
While the current version of the spec doesn't say much about how this endpoint uses filters (see matrix-org/matrix-spec-proposals#2338), the current implementation is that some fields of an EventFilter apply (the ones that are used when running the SQL query) and others don't (the ones that are used by the filter itself) because we don't call event_filter.filter(...). This seems counter-intuitive and probably not what we want so this commit fixes it.
  • Loading branch information
babolivier committed Nov 5, 2019
1 parent 4e1c7b7 commit 1dffa78
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,10 @@ def filter_evts(events):
room_id, event_id, before_limit, after_limit, event_filter
)

results["events_before"] = yield filter_evts(results["events_before"])
results["events_after"] = yield filter_evts(results["events_after"])
filtered_before_events = event_filter.filter(results["events_before"])
results["events_before"] = yield filter_evts(filtered_before_events)
filtered_after_events = event_filter.filter(results["events_after"])
results["events_after"] = yield filter_evts(filtered_after_events)
results["event"] = event

if results["events_after"]:
Expand Down

0 comments on commit 1dffa78

Please sign in to comment.