Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 07569f2

Browse files
authored
Merge pull request #7160 from matrix-org/dbkr/always_send_own_device_list_updates
Always send the user updates to their own device list
2 parents 6486c96 + 104844c commit 07569f2

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

changelog.d/7160.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Always send users their own device updates.

synapse/handlers/device.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,14 @@ def get_user_ids_changed(self, user_id, from_token):
125125
users_who_share_room = yield self.store.get_users_who_share_room_with_user(
126126
user_id
127127
)
128+
129+
tracked_users = set(users_who_share_room)
130+
131+
# Always tell the user about their own devices
132+
tracked_users.add(user_id)
133+
128134
changed = yield self.store.get_users_whose_devices_changed(
129-
from_token.device_list_key, users_who_share_room
135+
from_token.device_list_key, tracked_users
130136
)
131137

132138
# Then work out if any users have since joined
@@ -456,7 +462,11 @@ def notify_device_update(self, user_id, device_ids):
456462

457463
room_ids = yield self.store.get_rooms_for_user(user_id)
458464

459-
yield self.notifier.on_new_event("device_list_key", position, rooms=room_ids)
465+
# specify the user ID too since the user should always get their own device list
466+
# updates, even if they aren't in any rooms.
467+
yield self.notifier.on_new_event(
468+
"device_list_key", position, users=[user_id], rooms=room_ids
469+
)
460470

461471
if hosts:
462472
logger.info(

synapse/handlers/sync.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,9 +1143,14 @@ async def _generate_sync_entry_for_device_list(
11431143
user_id
11441144
)
11451145

1146+
tracked_users = set(users_who_share_room)
1147+
1148+
# Always tell the user about their own devices
1149+
tracked_users.add(user_id)
1150+
11461151
# Step 1a, check for changes in devices of users we share a room with
11471152
users_that_have_changed = await self.store.get_users_whose_devices_changed(
1148-
since_token.device_list_key, users_who_share_room
1153+
since_token.device_list_key, tracked_users
11491154
)
11501155

11511156
# Step 1b, check for newly joined rooms

0 commit comments

Comments
 (0)