summary refs log tree commit diff
diff options
context:
space:
mode:
-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",