summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-03 15:32:17 +0000
committerErik Johnston <erik@matrix.org>2015-02-03 15:32:17 +0000
commit9bace3a36751deed141225ccabd5bebecebc25f3 (patch)
treef45c534eabde779d43109e688fa8c9afd20d01c3 /synapse/events
parentRemove unused imports (diff)
downloadsynapse-9bace3a36751deed141225ccabd5bebecebc25f3.tar.xz
Actually, the old prune_event function was non-deterministic, so no point keeping it around :(
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/utils.py79
1 files changed, 0 insertions, 79 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py
index 65a9f70982..1aa952150e 100644
--- a/synapse/events/utils.py
+++ b/synapse/events/utils.py
@@ -94,85 +94,6 @@ def prune_event(event):
     )
 
 
-def old_prune_event(event):
-    """This is an old and buggy version of the prune event function. The
-    difference between this and the new version is that when including dicts
-    in the content they were included as frozen_dicts rather than dicts. This
-    caused the JSON encoder to encode as a list of the keys rather than the
-    dict.
-    """
-    event_type = event.type
-
-    allowed_keys = [
-        "event_id",
-        "sender",
-        "room_id",
-        "hashes",
-        "signatures",
-        "content",
-        "type",
-        "state_key",
-        "depth",
-        "prev_events",
-        "prev_state",
-        "auth_events",
-        "origin",
-        "origin_server_ts",
-        "membership",
-    ]
-
-    event_dict = event.get_dict()
-
-    new_content = {}
-
-    def add_fields(*fields):
-        for field in fields:
-            if field in event.content:
-                # This is the line that is buggy: event.content may return
-                # a frozen_dict which the json encoders encode as lists rather
-                # than dicts.
-                new_content[field] = event.content[field]
-
-    if event_type == EventTypes.Member:
-        add_fields("membership")
-    elif event_type == EventTypes.Create:
-        add_fields("creator")
-    elif event_type == EventTypes.JoinRules:
-        add_fields("join_rule")
-    elif event_type == EventTypes.PowerLevels:
-        add_fields(
-            "users",
-            "users_default",
-            "events",
-            "events_default",
-            "events_default",
-            "state_default",
-            "ban",
-            "kick",
-            "redact",
-        )
-    elif event_type == EventTypes.Aliases:
-        add_fields("aliases")
-
-    allowed_fields = {
-        k: v
-        for k, v in event_dict.items()
-        if k in allowed_keys
-    }
-
-    allowed_fields["content"] = new_content
-
-    allowed_fields["unsigned"] = {}
-
-    if "age_ts" in event.unsigned:
-        allowed_fields["unsigned"]["age_ts"] = event.unsigned["age_ts"]
-
-    return type(event)(
-        allowed_fields,
-        internal_metadata_dict=event.internal_metadata.get_dict()
-    )
-
-
 def format_event_raw(d):
     return d