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

Do not show invite-only rooms in spaces summary (unless joined/invited). #10109

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions changelog.d/10109.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in v1.35.0 where invite-only rooms would be shown to users in a space who were not invited.
19 changes: 9 additions & 10 deletions synapse/handlers/space_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
HistoryVisibility,
Membership,
)
from synapse.api.errors import AuthError
from synapse.events import EventBase
from synapse.events.utils import format_event_for_client_v2
from synapse.types import JsonDict
Expand Down Expand Up @@ -456,16 +455,16 @@ async def _is_room_accessible(
return True

# Otherwise, check if they should be allowed access via membership in a space.
try:
await self._event_auth_handler.check_restricted_join_rules(
state_ids, room_version, requester, member_event
if self._event_auth_handler.has_restricted_join_rules(
state_ids, room_version
):
allowed_spaces = (
await self._event_auth_handler.get_spaces_that_allow_join(state_ids)
)
except AuthError:
# The user doesn't have access due to spaces, but might have access
# another way. Keep trying.
pass
else:
return True
if await self._event_auth_handler.is_user_in_rooms(
allowed_spaces, requester
):
return True

# If this is a request over federation, check if the host is in the room or
# is in one of the spaces specified via the join rules.
Expand Down