summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-11 15:16:55 +0000
committerErik Johnston <erik@matrix.org>2014-12-11 15:16:55 +0000
commit9191292b0f657f6210e88f16ffd9a182bfab8170 (patch)
treeabcf0f4f26d91a2650a4f6f28a0c48cfa2a559ef /synapse
parentFix redaction tests (diff)
downloadsynapse-9191292b0f657f6210e88f16ffd9a182bfab8170.tar.xz
Fix prev_content
Diffstat (limited to 'synapse')
-rw-r--r--synapse/events/utils.py8
-rw-r--r--synapse/storage/_base.py6
2 files changed, 14 insertions, 0 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py
index 6d9c9352e2..4ab770dd5f 100644
--- a/synapse/events/utils.py
+++ b/synapse/events/utils.py
@@ -113,6 +113,14 @@ def serialize_event(hs, e):
         d["redacted_by"] = e.unsigned["redacted_by"]
         del d["unsigned"]["redacted_by"]
 
+    if "replaces_state" in e.unsigned:
+        d["replaces_state"] = e.unsigned["replaces_state"]
+        del d["unsigned"]["replaces_state"]
+
+    if "prev_content" in e.unsigned:
+        d["prev_content"] = e.unsigned["prev_content"]
+        del d["unsigned"]["prev_content"]
+
     del d["auth_events"]
     del d["prev_events"]
     del d["hashes"]
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index ffc26d4a61..e9cf73a8e2 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -487,6 +487,12 @@ class SQLBaseStore(object):
             if because:
                 ev.unsigned["redacted_because"] = because
 
+        if "replaces_state" in ev.unsigned:
+            ev.unsigned["prev_content"] = self._get_event_txn(
+                txn,
+                ev.unsigned["replaces_state"],
+            ).get_dict()["content"]
+
         return ev
 
     def _parse_events(self, rows):