Merge pull request #7160 from matrix-org/dbkr/always_send_own_device_list_updates

Always send the user updates to their own device list
This commit is contained in:
David Baker 2020-03-30 14:34:28 +01:00 committed by GitHub
commit 07569f25d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

1
changelog.d/7160.feature Normal file
View file

@ -0,0 +1 @@
Always send users their own device updates.

View file

@ -125,8 +125,14 @@ class DeviceWorkerHandler(BaseHandler):
users_who_share_room = yield self.store.get_users_who_share_room_with_user( users_who_share_room = yield self.store.get_users_who_share_room_with_user(
user_id user_id
) )
tracked_users = set(users_who_share_room)
# Always tell the user about their own devices
tracked_users.add(user_id)
changed = yield self.store.get_users_whose_devices_changed( changed = yield self.store.get_users_whose_devices_changed(
from_token.device_list_key, users_who_share_room from_token.device_list_key, tracked_users
) )
# Then work out if any users have since joined # Then work out if any users have since joined
@ -456,7 +462,11 @@ class DeviceHandler(DeviceWorkerHandler):
room_ids = yield self.store.get_rooms_for_user(user_id) room_ids = yield self.store.get_rooms_for_user(user_id)
yield self.notifier.on_new_event("device_list_key", position, rooms=room_ids) # specify the user ID too since the user should always get their own device list
# updates, even if they aren't in any rooms.
yield self.notifier.on_new_event(
"device_list_key", position, users=[user_id], rooms=room_ids
)
if hosts: if hosts:
logger.info( logger.info(

View file

@ -1143,9 +1143,14 @@ class SyncHandler(object):
user_id user_id
) )
tracked_users = set(users_who_share_room)
# Always tell the user about their own devices
tracked_users.add(user_id)
# Step 1a, check for changes in devices of users we share a room with # Step 1a, check for changes in devices of users we share a room with
users_that_have_changed = await self.store.get_users_whose_devices_changed( users_that_have_changed = await self.store.get_users_whose_devices_changed(
since_token.device_list_key, users_who_share_room since_token.device_list_key, tracked_users
) )
# Step 1b, check for newly joined rooms # Step 1b, check for newly joined rooms