summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-01-08 13:57:29 +0000
committerKegan Dougal <kegan@matrix.org>2015-01-08 13:57:40 +0000
commit5720ab59e03d6f5ab48c3be22e8957a8891ea56c (patch)
tree93186a77a9f70485724bd0d419e1339bb7a776cb /synapse/events
parentAdd optional limit to graph script (diff)
downloadsynapse-5720ab59e03d6f5ab48c3be22e8957a8891ea56c.tar.xz
Add 'raw' query parameter to expose the event graph and signatures to savvy clients.
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/utils.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py
index 4f4914467c..258dedb27c 100644
--- a/synapse/events/utils.py
+++ b/synapse/events/utils.py
@@ -89,7 +89,7 @@ def prune_event(event):
     return type(event)(allowed_fields)
 
 
-def serialize_event(hs, e):
+def serialize_event(hs, e, remove_data=True):
     # FIXME(erikj): To handle the case of presence events and the like
     if not isinstance(e, EventBase):
         return e
@@ -122,12 +122,13 @@ def serialize_event(hs, e):
         d["prev_content"] = e.unsigned["prev_content"]
         del d["unsigned"]["prev_content"]
 
-    del d["auth_events"]
-    del d["prev_events"]
-    del d["hashes"]
-    del d["signatures"]
-    d.pop("depth", None)
-    d.pop("unsigned", None)
-    d.pop("origin", None)
+    if remove_data:
+        del d["auth_events"]
+        del d["prev_events"]
+        del d["hashes"]
+        del d["signatures"]
+        d.pop("depth", None)
+        d.pop("unsigned", None)
+        d.pop("origin", None)
 
     return d