diff options
author | Erik Johnston <erik@matrix.org> | 2017-09-08 14:44:36 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-09-08 14:44:36 +0100 |
commit | 69ef4987a68d66093007ca11886e25139ea0c970 (patch) | |
tree | 9794dea29cadedb4f8ec5ab1fded01df274dde22 /synapse/handlers/device.py | |
parent | Send down device list change notif when member leaves/rejoins room (diff) | |
download | synapse-69ef4987a68d66093007ca11886e25139ea0c970.tar.xz |
Add left section to /keys/changes
Diffstat (limited to 'synapse/handlers/device.py')
-rw-r--r-- | synapse/handlers/device.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index be120b2f34..ef8753b1ff 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -326,13 +326,23 @@ class DeviceHandler(BaseHandler): possibly_changed.add(state_key) break - users_who_share_room = yield self.store.get_users_who_share_room_with_user( - user_id - ) + if possibly_changed: + users_who_share_room = yield self.store.get_users_who_share_room_with_user( + user_id + ) - # Take the intersection of the users whose devices may have changed - # and those that actually still share a room with the user - defer.returnValue(users_who_share_room & possibly_changed) + # Take the intersection of the users whose devices may have changed + # and those that actually still share a room with the user + possibly_joined = possibly_changed & users_who_share_room + possibly_left = possibly_changed - users_who_share_room + else: + possibly_joined = [] + possibly_left = [] + + defer.returnValue({ + "changed": list(possibly_joined), + "left": list(possibly_left), + }) @defer.inlineCallbacks def on_federation_query_user_devices(self, user_id): |