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

Fix adding excluded users to the private room sharing tables when joining a room #11143

Merged
merged 9 commits into from
Oct 21, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions synapse/handlers/user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,23 +376,22 @@ async def _track_user_joined_room(self, room_id: str, user_id: str) -> None:
if is_public:
await self.store.add_users_in_public_rooms(room_id, (user_id,))
else:
other_users_in_room = await self.store.get_users_in_room(room_id)
users_in_room = await self.store.get_users_in_room(room_id)
other_users_in_room = [
other
for other in users_in_room
if other != user_id
]
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
to_insert = set()

# First, if they're our user then we need to update for every user
if self.is_mine_id(user_id):
if await self.store.should_include_local_user_in_dir(user_id):
for other_user_id in other_users_in_room:
if user_id == other_user_id:
continue

to_insert.add((user_id, other_user_id))

# Next we need to update for every local user in the room
for other_user_id in other_users_in_room:
if user_id == other_user_id:
continue

include_other_user = self.is_mine_id(
other_user_id
) and await self.store.should_include_local_user_in_dir(other_user_id)
Expand Down