diff options
author | Erik Johnston <erik@matrix.org> | 2019-01-29 21:46:17 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-01-29 21:48:36 +0000 |
commit | 4db252c0738c590ed5fa0b53c61f9dd9da1cb33e (patch) | |
tree | 7e063a0fff777c887c36758d87e2bbe77b2229f1 | |
parent | Fix typo (diff) | |
download | synapse-4db252c0738c590ed5fa0b53c61f9dd9da1cb33e.tar.xz |
Check redaction state when event is pulled out of the database
-rw-r--r-- | synapse/storage/events_worker.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/storage/events_worker.py b/synapse/storage/events_worker.py index 0ff80fa728..1d75e309b3 100644 --- a/synapse/storage/events_worker.py +++ b/synapse/storage/events_worker.py @@ -466,6 +466,19 @@ class EventsWorkerStore(SQLBaseStore): # will serialise this field correctly redacted_event.unsigned["redacted_because"] = because + # Starting in room version v3, some redactions need to be + # rechecked if we didn't have the redacted event at the + # time, so we recheck on read instead. + if because.internal_metadata.need_to_check_redaction(): + expected_domain = get_domain_from_id(original_ev.sender) + if get_domain_from_id(because.sender) == expected_domain: + # This redaction event is allowed. Mark as not needing a + # recheck. + because.internal_metadata.recheck_redaction = False + else: + # Senders don't match, so the event is actually redacted + redacted_event = None + cache_entry = _EventCacheEntry( event=original_ev, redacted_event=redacted_event, |