summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2019-10-10 15:56:00 -0400
committerHubert Chathi <hubert@uhoreg.ca>2019-10-10 19:15:30 -0400
commit4908fb3b30ac007fda5993521448804067751a6d (patch)
treeb20e457ce6d43739c9d66609e46145c43950caf9 /synapse/storage
parentMerge pull request #6185 from matrix-org/erikj/fix_censored_evnets (diff)
downloadsynapse-4908fb3b30ac007fda5993521448804067751a6d.tar.xz
make storage layer in charge of interpreting the device key data
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/end_to_end_keys.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/synapse/storage/end_to_end_keys.py b/synapse/storage/end_to_end_keys.py
index 33e3a84933..d802d7a485 100644
--- a/synapse/storage/end_to_end_keys.py
+++ b/synapse/storage/end_to_end_keys.py
@@ -40,7 +40,7 @@ class EndToEndKeyWorkerStore(SQLBaseStore):
                 This option only takes effect if include_all_devices is true.
         Returns:
             Dict mapping from user-id to dict mapping from device_id to
-            dict containing "key_json", "device_display_name".
+            key data.
         """
         set_tag("query_list", query_list)
         if not query_list:
@@ -54,9 +54,16 @@ class EndToEndKeyWorkerStore(SQLBaseStore):
             include_deleted_devices,
         )
 
+        # Build the result structure, un-jsonify the results, and add the
+        # "unsigned" section
         for user_id, device_keys in iteritems(results):
             for device_id, device_info in iteritems(device_keys):
-                device_info["keys"] = db_to_json(device_info.pop("key_json"))
+                r = db_to_json(device_info.pop("key_json"))
+                r["unsigned"] = {}
+                display_name = device_info["device_display_name"]
+                if display_name is not None:
+                    r["unsigned"]["device_display_name"] = display_name
+                results[user_id][device_id] = r
 
         return results