summary refs log tree commit diff
path: root/synapse/events/utils.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-10-05 14:43:14 +0100
committerGitHub <noreply@github.com>2020-10-05 14:43:14 +0100
commitf31f8e63198cfe46af48d788dbb294aba9155e5a (patch)
tree603352c2adac33e3348be771f54f4c8d130eb582 /synapse/events/utils.py
parentUpdate manhole documentation for async/await. (#8462) (diff)
downloadsynapse-f31f8e63198cfe46af48d788dbb294aba9155e5a.tar.xz
Remove stream ordering from Metadata dict (#8452)
There's no need for it to be in the dict as well as the events table. Instead,
we store it in a separate attribute in the EventInternalMetadata object, and
populate that on load.

This means that we can rely on it being correctly populated for any event which
has been persited to the database.
Diffstat (limited to 'synapse/events/utils.py')
-rw-r--r--synapse/events/utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py
index 32c73d3413..355cbe05f1 100644
--- a/synapse/events/utils.py
+++ b/synapse/events/utils.py
@@ -49,6 +49,11 @@ def prune_event(event: EventBase) -> EventBase:
         pruned_event_dict, event.room_version, event.internal_metadata.get_dict()
     )
 
+    # copy the internal fields
+    pruned_event.internal_metadata.stream_ordering = (
+        event.internal_metadata.stream_ordering
+    )
+
     # Mark the event as redacted
     pruned_event.internal_metadata.redacted = True