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

Commit 36a7ff0

Browse files
committed
Do not show invite-only rooms in spaces summary (unless joined/invited). (#10109)
1 parent 3fdaf4d commit 36a7ff0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

changelog.d/10109.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

synapse/handlers/space_summary.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
HistoryVisibility,
2727
Membership,
2828
)
29-
from synapse.api.errors import AuthError
3029
from synapse.events import EventBase
3130
from synapse.events.utils import format_event_for_client_v2
3231
from synapse.types import JsonDict
@@ -456,16 +455,16 @@ async def _is_room_accessible(
456455
return True
457456

458457
# Otherwise, check if they should be allowed access via membership in a space.
459-
try:
460-
await self._event_auth_handler.check_restricted_join_rules(
461-
state_ids, room_version, requester, member_event
458+
if self._event_auth_handler.has_restricted_join_rules(
459+
state_ids, room_version
460+
):
461+
allowed_spaces = (
462+
await self._event_auth_handler.get_spaces_that_allow_join(state_ids)
462463
)
463-
except AuthError:
464-
# The user doesn't have access due to spaces, but might have access
465-
# another way. Keep trying.
466-
pass
467-
else:
468-
return True
464+
if await self._event_auth_handler.is_user_in_rooms(
465+
allowed_spaces, requester
466+
):
467+
return True
469468

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

0 commit comments

Comments
 (0)