summary refs log tree commit diff
path: root/synapse/events/utils.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-04-05 14:42:46 -0400
committerGitHub <noreply@github.com>2023-04-05 14:42:46 -0400
commit83649b891db5fcca7b96c606293925bc47358730 (patch)
tree691ca08f39c62a6b3c891052a4f062965a233bf7 /synapse/events/utils.py
parentDelete server-side backup keys when deactivating an account. (#15181) (diff)
downloadsynapse-83649b891db5fcca7b96c606293925bc47358730.tar.xz
Implement MSC3989 to redact the origin field. (#15393)
This will be done in a future room version, for now an unstable
room version is added which redacts the origin field.
Diffstat (limited to 'synapse/events/utils.py')
-rw-r--r--synapse/events/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py
index c14c7791db..1d5d7491cd 100644
--- a/synapse/events/utils.py
+++ b/synapse/events/utils.py
@@ -106,7 +106,6 @@ def prune_event_dict(room_version: RoomVersion, event_dict: JsonDict) -> JsonDic
         "depth",
         "prev_events",
         "auth_events",
-        "origin",
         "origin_server_ts",
     ]
 
@@ -114,6 +113,10 @@ def prune_event_dict(room_version: RoomVersion, event_dict: JsonDict) -> JsonDic
     if not room_version.msc2176_redaction_rules:
         allowed_keys.extend(["prev_state", "membership"])
 
+    # Room versions before MSC3989 kept the origin field.
+    if not room_version.msc3989_redaction_rules:
+        allowed_keys.append("origin")
+
     event_type = event_dict["type"]
 
     new_content = {}