summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-11-05 12:21:59 +0000
committerBrendan Abolivier <babolivier@matrix.org>2019-11-05 12:21:59 +0000
commit1dffa78701d43b299419090d544fb8bb91ab4d5b (patch)
tree0fda7d3bfea7f7671f0b886d048138356e824b79 /synapse
parentRemove the psutil dependency (#6318) (diff)
downloadsynapse-1dffa78701d43b299419090d544fb8bb91ab4d5b.tar.xz
Filter events_before and events_after in /context requests
While the current version of the spec doesn't say much about how this endpoint uses filters (see https://github.com/matrix-org/matrix-doc/issues/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.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/room.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index e92b2eafd5..899bb63114 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -874,8 +874,10 @@ class RoomContextHandler(object):
             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"]: