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

Use the filtered version of an event when responding to /context requests for that event #6553

Merged
merged 8 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6553.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug causing responses to the `/context` client endpoint to not use the pruned version of the event the request is for.
babolivier marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 4 additions & 1 deletion synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,10 @@ def filter_evts(events):

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
Expand Down
3 changes: 2 additions & 1 deletion synapse/visibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def filter_events_for_client(
apply_retention_policies=True,
):
"""
Check which events a user is allowed to see
Check which events a user is allowed to see. If the user can see the event but its
sender asked for their data to be erased, prune the content of the event.

Args:
storage
Expand Down