0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-16 15:01:23 +01:00

Only setdefault for signatures if device has key_json

This commit is contained in:
Andrew Morgan 2020-03-30 18:05:09 +01:00
parent db098ec994
commit b5ecafd157

View file

@ -317,14 +317,16 @@ class DeviceWorkerStore(SQLBaseStore):
key_json = device.get("key_json", None) key_json = device.get("key_json", None)
if key_json: if key_json:
result["keys"] = db_to_json(key_json) result["keys"] = db_to_json(key_json)
device_display_name = device.get("device_display_name", None)
if device_display_name:
result["device_display_name"] = device_display_name
if "signatures" in device: if "signatures" in device:
for sig_user_id, sigs in device["signatures"].items(): for sig_user_id, sigs in device["signatures"].items():
result["keys"].setdefault("signatures", {}).setdefault( result["keys"].setdefault("signatures", {}).setdefault(
sig_user_id, {} sig_user_id, {}
).update(sigs) ).update(sigs)
device_display_name = device.get("device_display_name", None)
if device_display_name:
result["device_display_name"] = device_display_name
else: else:
result["deleted"] = True result["deleted"] = True