summary refs log tree commit diff
path: root/synapse/events/utils.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-12-01 11:14:48 +0000
committerMark Haines <mark.haines@matrix.org>2015-12-01 11:14:48 +0000
commit306415391dfe1a304738f307440d7bd79fe93972 (patch)
treea6541264f62dabc4ee53d3f2a49b21bf16041eae /synapse/events/utils.py
parentCopy rather than move the fields to shuffle between a v1 and a v2 event. (diff)
downloadsynapse-306415391dfe1a304738f307440d7bd79fe93972.tar.xz
Only add the user_id if the sender is present
Diffstat (limited to '')
-rw-r--r--synapse/events/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py
index 666df54114..e634b149ba 100644
--- a/synapse/events/utils.py
+++ b/synapse/events/utils.py
@@ -102,7 +102,9 @@ def format_event_raw(d):
 def format_event_for_client_v1(d):
     d = format_event_for_client_v2(d)
 
-    d["user_id"] = d.get("sender", None)
+    sender = d.get("sender")
+    if sender is not None:
+        d["user_id"] = sender
 
     copy_keys = (
         "age", "redacted_because", "replaces_state", "prev_content",