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

Fix 'FederationGroupsRoomsServlet' API when group has room server is not in. #7599

Merged
merged 2 commits into from
May 29, 2020
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/7599.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where returning rooms for a group would fail if it included a room that the server was not in.
20 changes: 12 additions & 8 deletions synapse/handlers/room_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,21 @@ def generate_room_entry(
"""
result = {"room_id": room_id, "num_joined_members": num_joined_users}

if with_alias:
aliases = yield self.store.get_aliases_for_room(
room_id, on_invalidate=cache_context.invalidate
)
if aliases:
result["aliases"] = aliases

current_state_ids = yield self.store.get_current_state_ids(
room_id, on_invalidate=cache_context.invalidate
)

if not current_state_ids:
# We're not in the room, so may as well bail out here.
return result

event_map = yield self.store.get_events(
[
event_id
Expand Down Expand Up @@ -289,14 +300,7 @@ def generate_room_entry(
create_event = current_state.get((EventTypes.Create, ""))
result["m.federate"] = create_event.content.get("m.federate", True)

if with_alias:
aliases = yield self.store.get_aliases_for_room(
room_id, on_invalidate=cache_context.invalidate
)
if aliases:
result["aliases"] = aliases

name_event = yield current_state.get((EventTypes.Name, ""))
name_event = current_state.get((EventTypes.Name, ""))
if name_event:
name = name_event.content.get("name", None)
if name:
Expand Down