summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-30 18:05:09 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-31 11:26:29 +0100
commitb5ecafd1576649c86fdb31d4d4a2f374a3464184 (patch)
tree60e8fabcde02ee0906319b878c8c7c5fa83ce182 /synapse
parentFix starting workers when federation sending not split out. (diff)
downloadsynapse-b5ecafd1576649c86fdb31d4d4a2f374a3464184.tar.xz
Only setdefault for signatures if device has key_json
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/data_stores/main/devices.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/synapse/storage/data_stores/main/devices.py b/synapse/storage/data_stores/main/devices.py
index d55733a4cd..84d8deca18 100644
--- a/synapse/storage/data_stores/main/devices.py
+++ b/synapse/storage/data_stores/main/devices.py
@@ -317,14 +317,16 @@ class DeviceWorkerStore(SQLBaseStore):
                     key_json = device.get("key_json", None)
                     if key_json:
                         result["keys"] = db_to_json(key_json)
+
+                        if "signatures" in device:
+                            for sig_user_id, sigs in device["signatures"].items():
+                                result["keys"].setdefault("signatures", {}).setdefault(
+                                    sig_user_id, {}
+                                ).update(sigs)
+
                     device_display_name = device.get("device_display_name", None)
                     if device_display_name:
                         result["device_display_name"] = device_display_name
-                    if "signatures" in device:
-                        for sig_user_id, sigs in device["signatures"].items():
-                            result["keys"].setdefault("signatures", {}).setdefault(
-                                sig_user_id, {}
-                            ).update(sigs)
                 else:
                     result["deleted"] = True