diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-12-01 11:14:48 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-12-01 11:14:48 +0000 |
commit | 306415391dfe1a304738f307440d7bd79fe93972 (patch) | |
tree | a6541264f62dabc4ee53d3f2a49b21bf16041eae /synapse/events | |
parent | Copy rather than move the fields to shuffle between a v1 and a v2 event. (diff) | |
download | synapse-306415391dfe1a304738f307440d7bd79fe93972.tar.xz |
Only add the user_id if the sender is present
Diffstat (limited to 'synapse/events')
-rw-r--r-- | synapse/events/utils.py | 4 |
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", |