diff options
author | Eric Eastwood <erice@element.io> | 2021-08-09 20:23:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 20:23:31 -0500 |
commit | 7afb615839a2df05d39f87718016d278ebdadf5c (patch) | |
tree | 64194132fa88e8ff69c44b3af91dcaeeb1f80d69 /synapse/events | |
parent | Do not remove `status_msg` when user going offline (#10550) (diff) | |
download | synapse-7afb615839a2df05d39f87718016d278ebdadf5c.tar.xz |
When redacting, keep event fields around that maintain the historical event structure intact (MSC2716) (#10538)
* Keep event fields that maintain the historical event structure intact Fix https://github.com/matrix-org/synapse/issues/10521 * Add changelog * Bump room version * Better changelog text * Fix up room version after develop merge
Diffstat (limited to 'synapse/events')
-rw-r--r-- | synapse/events/utils.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py index a0c07f62f4..b6da2f60af 100644 --- a/synapse/events/utils.py +++ b/synapse/events/utils.py @@ -17,7 +17,7 @@ from typing import Any, Mapping, Union from frozendict import frozendict -from synapse.api.constants import EventTypes, RelationTypes +from synapse.api.constants import EventContentFields, EventTypes, RelationTypes from synapse.api.errors import Codes, SynapseError from synapse.api.room_versions import RoomVersion from synapse.util.async_helpers import yieldable_gather_results @@ -135,6 +135,12 @@ def prune_event_dict(room_version: RoomVersion, event_dict: dict) -> dict: add_fields("history_visibility") elif event_type == EventTypes.Redaction and room_version.msc2176_redaction_rules: add_fields("redacts") + elif room_version.msc2716_redactions and event_type == EventTypes.MSC2716_INSERTION: + add_fields(EventContentFields.MSC2716_NEXT_CHUNK_ID) + elif room_version.msc2716_redactions and event_type == EventTypes.MSC2716_CHUNK: + add_fields(EventContentFields.MSC2716_CHUNK_ID) + elif room_version.msc2716_redactions and event_type == EventTypes.MSC2716_MARKER: + add_fields(EventContentFields.MSC2716_MARKER_INSERTION) allowed_fields = {k: v for k, v in event_dict.items() if k in allowed_keys} |