Noop device key changes if they're the same

This commit is contained in:
Erik Johnston 2017-01-30 16:55:04 +00:00
parent e75a779d9e
commit c2c9a78db9
3 changed files with 45 additions and 15 deletions

View file

@ -287,11 +287,12 @@ class E2eKeysHandler(object):
device_id, user_id, time_now
)
# TODO: Sign the JSON with the server key
yield self.store.set_e2e_device_keys(
user_id, device_id, time_now,
encode_canonical_json(device_keys)
changed = yield self.store.set_e2e_device_keys(
user_id, device_id, time_now, device_keys,
)
yield self.device_handler.notify_device_update(user_id, [device_id])
if changed:
# Only notify about device updates *if* the keys actually changed
yield self.device_handler.notify_device_update(user_id, [device_id])
one_time_keys = keys.get("one_time_keys", None)
if one_time_keys: