summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-12-16 16:24:10 +0000
committerGitHub <noreply@github.com>2019-12-16 16:24:10 +0000
commit6316530366c8d7e8ee9e2c06009312c5405a352b (patch)
treeb607e22e9be4a0caac1c03022eaf753b4abc0ead /synapse/handlers
parentExclude rejected state events when calculating state at backwards extrems (#6... (diff)
parentMerge branch 'babolivier/fix-context-filter' of github.com:matrix-org/synapse... (diff)
downloadsynapse-6316530366c8d7e8ee9e2c06009312c5405a352b.tar.xz
Merge pull request #6553 from matrix-org/babolivier/fix-context-filter
 Use the filtered version of an event when responding to /context requests for that event
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/room.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 22768e97ff..60b8bbc7a5 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -907,7 +907,10 @@ class RoomContextHandler(object):
 
         results["events_before"] = yield filter_evts(results["events_before"])
         results["events_after"] = yield filter_evts(results["events_after"])
-        results["event"] = event
+        # filter_evts can return a pruned event in case the user is allowed to see that
+        # there's something there but not see the content, so use the event that's in
+        # `filtered` rather than the event we retrieved from the datastore.
+        results["event"] = filtered[0]
 
         if results["events_after"]:
             last_event_id = results["events_after"][-1].event_id
@@ -938,7 +941,7 @@ class RoomContextHandler(object):
         if event_filter:
             state_events = event_filter.filter(state_events)
 
-        results["state"] = state_events
+        results["state"] = yield filter_evts(state_events)
 
         # We use a dummy token here as we only care about the room portion of
         # the token, which we replace.