@@ -185,8 +185,12 @@ async def _get_room_hierarchy(
185
185
186
186
# First of all, check that the room is accessible locally.
187
187
# OR accessible through federation.
188
- local_room = await self ._store .is_host_joined (room_id , self ._server_name )
189
- if local_room and not await self ._is_local_room_accessible (requested_room_id , requester ):
188
+ local_room = await self ._store .is_host_joined (
189
+ requested_room_id , self ._server_name
190
+ )
191
+ if local_room and not await self ._is_local_room_accessible (
192
+ requested_room_id , requester
193
+ ):
190
194
raise UnstableSpecAuthError (
191
195
403 ,
192
196
"User %s not in room %s, and room previews are disabled"
@@ -195,15 +199,14 @@ async def _get_room_hierarchy(
195
199
)
196
200
197
201
if not local_room :
198
- (
199
- room_entry ,
200
- children_room_entries ,
201
- inaccessible_children ,
202
- ) = await self ._summarize_remote_room_hierarchy (
202
+ room_hierarchy = await self ._summarize_remote_room_hierarchy (
203
203
_RoomQueueEntry (requested_room_id , ()),
204
204
False ,
205
205
)
206
- if not room_entry or not await self ._is_remote_room_accessible (requester , requested_room_id , room_entry .room ):
206
+ root_room_entry = room_hierarchy [0 ]
207
+ if not root_room_entry or not await self ._is_remote_room_accessible (
208
+ requester , requested_room_id , root_room_entry .room
209
+ ):
207
210
raise UnstableSpecAuthError (
208
211
403 ,
209
212
"User %s not in room %s, and room previews are disabled"
0 commit comments