diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2019-07-30 15:56:02 +0200 |
---|---|---|
committer | Brendan Abolivier <babolivier@matrix.org> | 2019-07-30 15:56:02 +0200 |
commit | 0fda4e2e50b7ee33458cba58085147bc459453fe (patch) | |
tree | dd85195ccd957028149237ca2e140f715065b3d2 | |
parent | Don't make the checks depend on recheck_redaction (diff) | |
download | synapse-0fda4e2e50b7ee33458cba58085147bc459453fe.tar.xz |
Should now work, unless we can't find the redaction event which happens for some reason (need to investigate)
-rw-r--r-- | synapse/storage/events_worker.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/synapse/storage/events_worker.py b/synapse/storage/events_worker.py index b5604cbdef..2983aec55b 100644 --- a/synapse/storage/events_worker.py +++ b/synapse/storage/events_worker.py @@ -559,26 +559,26 @@ class EventsWorkerStore(SQLBaseStore): ) if because: + # It's fine to do add the event directly, since get_pdu_json + # 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 isn't actually + # redacted + redacted_event = None + if because.room_id != original_ev.room_id: redacted_event = None - else: - # It's fine to do add the event directly, since get_pdu_json - # 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 isn't actually - # redacted - redacted_event = None cache_entry = _EventCacheEntry( event=original_ev, redacted_event=redacted_event |