From 2dcb306d3da32adc7d8079d7531e06a76b6b9b85 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 3 Dec 2021 23:04:53 +0100 Subject: [PATCH 01/19] Support MSC3266 room summaries over federation Signed-off-by: Nicolas Werner --- synapse/handlers/room_summary.py | 45 +++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 486145f48aca..bd264ed9e61f 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -812,9 +812,48 @@ async def get_room_summary( room_summary["membership"] = membership or "leave" else: - # TODO federation API, descoped from initial unstable implementation - # as MSC needs more maturing on that side. - raise SynapseError(400, "Federation is not currently supported.") + # Reuse the hierarchy query over federation + if remote_room_hosts is None: + raise SynapseError(400, "Missing via to query remote room") + + fed_rooms = await self._summarize_remote_room( + _RoomQueueEntry(room_id, remote_room_hosts), + suggested_only=True, + max_children=1, + exclude_rooms=[], + ) + + for room_entry in fed_rooms: + room = room_entry.room + fed_room_id = room_entry.room_id + + if fed_room_id == room_id: + # If no user is specified, test against an invalid userid + if requester is None: + requester = "" + + # The results over federation might include rooms that the we, + # as the requesting server, are allowed to see, but the requesting + # user is not permitted see. + # + # Filter the returned results to only what is accessible to the user. + if await self._is_remote_room_accessible( + requester, fed_room_id, room + ): + # Before returning to the client, remove the allowed_room_ids + # and allowed_spaces keys. + room.pop("allowed_room_ids", None) + room.pop("allowed_spaces", None) + + # A remote room can't be in the joined state + room["membership"] = "leave" + + return room + + else: + break + + raise NotFoundError("Room not found or is not accessible") return room_summary From 946ac907706148ed630e09bc6ed6e333b4bc91bb Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 3 Dec 2021 23:09:24 +0100 Subject: [PATCH 02/19] Add changelog --- changelog.d/11507.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/11507.feature diff --git a/changelog.d/11507.feature b/changelog.d/11507.feature new file mode 100644 index 000000000000..72c5690cca4a --- /dev/null +++ b/changelog.d/11507.feature @@ -0,0 +1 @@ +Support [MSC3266](https://github.com/matrix-org/matrix-doc/pull/3266) room summaries over federation. From 3269f1eece01bfdbee068330754b538b59c520d5 Mon Sep 17 00:00:00 2001 From: "DeepBlueV7.X" Date: Mon, 6 Dec 2021 15:25:07 +0100 Subject: [PATCH 03/19] Update synapse/handlers/room_summary.py Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> --- synapse/handlers/room_summary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index bd264ed9e61f..26ae27a9b750 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -834,7 +834,7 @@ async def get_room_summary( # The results over federation might include rooms that the we, # as the requesting server, are allowed to see, but the requesting - # user is not permitted see. + # user is not permitted to see. # # Filter the returned results to only what is accessible to the user. if await self._is_remote_room_accessible( From 9543837e08ec2aa990c18389bf8d4f0e54eb64a4 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 2 May 2022 19:17:47 +0200 Subject: [PATCH 04/19] Update to not use the deprecated summary federation API --- synapse/handlers/room_summary.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 26ae27a9b750..ec1897f5ae63 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -816,14 +816,16 @@ async def get_room_summary( if remote_room_hosts is None: raise SynapseError(400, "Missing via to query remote room") - fed_rooms = await self._summarize_remote_room( + ( + room_entry, + children_room_entries, + inaccessible_children, + ) = await self._summarize_remote_room_hierarchy( _RoomQueueEntry(room_id, remote_room_hosts), suggested_only=True, - max_children=1, - exclude_rooms=[], ) - for room_entry in fed_rooms: + if room_entry: room = room_entry.room fed_room_id = room_entry.room_id @@ -850,9 +852,6 @@ async def get_room_summary( return room - else: - break - raise NotFoundError("Room not found or is not accessible") return room_summary @@ -860,6 +859,7 @@ async def get_room_summary( @attr.s(frozen=True, slots=True, auto_attribs=True) class _RoomQueueEntry: + # The room ID of this entry. room_id: str # The server to query if the room is not known locally. From 7d4bafdbafe4a1e4c0ccf6dadf85057368332770 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 2 May 2022 19:35:45 +0200 Subject: [PATCH 05/19] Add encryption to summary --- synapse/handlers/room_summary.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index ec1897f5ae63..0c9db0d8c1c6 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -715,6 +715,9 @@ async def _build_room_entry(self, room_id: str, for_federation: bool) -> JsonDic "room_type": create_event.content.get(EventContentFields.ROOM_TYPE), } + if stats["encryption"]: + entry["im.nheko.summary.encryption"] = stats["encryption"] + # Federation requests need to provide additional information so the # requested server is able to filter the response appropriately. if for_federation: From 96c848d009fa4493983326111e90931e0e63484c Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 2 May 2022 19:59:40 +0200 Subject: [PATCH 06/19] Add room version field --- synapse/handlers/room_summary.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 0c9db0d8c1c6..c638b6f1c611 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -630,7 +630,7 @@ async def _is_local_room_accessible( return False async def _is_remote_room_accessible( - self, requester: str, room_id: str, room: JsonDict + self, requester: Optional[str], room_id: str, room: JsonDict ) -> bool: """ Calculate whether the room received over federation should be shown to the requester. @@ -645,7 +645,7 @@ async def _is_remote_room_accessible( due to an invite, etc. Args: - requester: The user requesting the summary. + requester: The user requesting the summary. If not passed only world readability is checked. room_id: The room ID returned over federation. room: The summary of the room returned over federation. @@ -659,6 +659,8 @@ async def _is_remote_room_accessible( or room.get("world_readable") is True ): return True + elif not requester: + return False # Check if the user is a member of any of the allowed rooms from the response. allowed_rooms = room.get("allowed_room_ids") @@ -713,6 +715,7 @@ async def _build_room_entry(self, room_id: str, for_federation: bool) -> JsonDic ), "guest_can_join": stats["guest_access"] == "can_join", "room_type": create_event.content.get(EventContentFields.ROOM_TYPE), + "im.nheko.summary.version": stats["version"], } if stats["encryption"]: @@ -833,10 +836,6 @@ async def get_room_summary( fed_room_id = room_entry.room_id if fed_room_id == room_id: - # If no user is specified, test against an invalid userid - if requester is None: - requester = "" - # The results over federation might include rooms that the we, # as the requesting server, are allowed to see, but the requesting # user is not permitted to see. From 51e637414fad15a020d14a7d245e4eac70065c19 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 2 May 2022 20:19:40 +0200 Subject: [PATCH 07/19] Don't manually exclude summary fields Signed-off-by: Nicolas Werner --- synapse/handlers/room_summary.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index c638b6f1c611..170b3e565085 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -716,11 +716,9 @@ async def _build_room_entry(self, room_id: str, for_federation: bool) -> JsonDic "guest_can_join": stats["guest_access"] == "can_join", "room_type": create_event.content.get(EventContentFields.ROOM_TYPE), "im.nheko.summary.version": stats["version"], + "im.nheko.summary.encryption": stats["encryption"], } - if stats["encryption"]: - entry["im.nheko.summary.encryption"] = stats["encryption"] - # Federation requests need to provide additional information so the # requested server is able to filter the response appropriately. if for_federation: From 10ac98651c69eda2ad6d794b6917c88408a53b91 Mon Sep 17 00:00:00 2001 From: "DeepBlueV7.X" Date: Wed, 4 May 2022 06:08:49 +0000 Subject: [PATCH 08/19] Apply suggestions from code review Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> --- synapse/handlers/room_summary.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 170b3e565085..b8ecc4332cdf 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -645,7 +645,8 @@ async def _is_remote_room_accessible( due to an invite, etc. Args: - requester: The user requesting the summary. If not passed only world readability is checked. + requester: The user requesting the summary. If not passed only world + readability is checked. room_id: The room ID returned over federation. room: The summary of the room returned over federation. @@ -843,9 +844,8 @@ async def get_room_summary( requester, fed_room_id, room ): # Before returning to the client, remove the allowed_room_ids - # and allowed_spaces keys. + # key. room.pop("allowed_room_ids", None) - room.pop("allowed_spaces", None) # A remote room can't be in the joined state room["membership"] = "leave" @@ -859,7 +859,6 @@ async def get_room_summary( @attr.s(frozen=True, slots=True, auto_attribs=True) class _RoomQueueEntry: - # The room ID of this entry. room_id: str # The server to query if the room is not known locally. From c8ae76336c36e409c9aa769f3926f5d92c6e81cf Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 4 May 2022 10:51:26 +0200 Subject: [PATCH 09/19] Add basic federation test for room summaries --- tests/handlers/test_room_summary.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/handlers/test_room_summary.py b/tests/handlers/test_room_summary.py index d37292ce138e..5a3a8575e1e7 100644 --- a/tests/handlers/test_room_summary.py +++ b/tests/handlers/test_room_summary.py @@ -1092,3 +1092,29 @@ def test_visibility(self): ) result = self.get_success(self.handler.get_room_summary(user2, self.room)) self.assertEqual(result.get("room_id"), self.room) + + def test_fed(self): + """ + Return data over federation and ensure that it is handled properly. + """ + fed_hostname = self.hs.hostname + "2" + fedroom = "#subroom:" + fed_hostname + + requested_room_entry = _RoomEntry( + fedroom, + {"room_id": fedroom, "world_readable": True}, + ) + + async def summarize_remote_room_hierarchy(_self, room, suggested_only): + return requested_room_entry, {}, set() + + with mock.patch( + "synapse.handlers.room_summary.RoomSummaryHandler._summarize_remote_room_hierarchy", + new=summarize_remote_room_hierarchy, + ): + result = self.get_success( + self.handler.get_room_summary( + self.user, fedroom, remote_room_hosts=[fed_hostname] + ) + ) + self.assertEqual(result.get("room_id"), fedroom) From 9f5ef278878a819a244e3aabaaa27fbcfe1b7a09 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 4 May 2022 12:19:15 +0200 Subject: [PATCH 10/19] fedroom -> fed_room Signed-off-by: Nicolas Werner --- tests/handlers/test_room_summary.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/handlers/test_room_summary.py b/tests/handlers/test_room_summary.py index 5a3a8575e1e7..e74eb71774df 100644 --- a/tests/handlers/test_room_summary.py +++ b/tests/handlers/test_room_summary.py @@ -1098,11 +1098,11 @@ def test_fed(self): Return data over federation and ensure that it is handled properly. """ fed_hostname = self.hs.hostname + "2" - fedroom = "#subroom:" + fed_hostname + fed_room = "#fed_room:" + fed_hostname requested_room_entry = _RoomEntry( - fedroom, - {"room_id": fedroom, "world_readable": True}, + fed_room, + {"room_id": fed_room, "world_readable": True}, ) async def summarize_remote_room_hierarchy(_self, room, suggested_only): @@ -1114,7 +1114,7 @@ async def summarize_remote_room_hierarchy(_self, room, suggested_only): ): result = self.get_success( self.handler.get_room_summary( - self.user, fedroom, remote_room_hosts=[fed_hostname] + self.user, fed_room, remote_room_hosts=[fed_hostname] ) ) - self.assertEqual(result.get("room_id"), fedroom) + self.assertEqual(result.get("room_id"), fed_room) From cbb58f260f5d42f9bafca0f8ec92f4e27aa3c25d Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 4 May 2022 12:41:20 +0200 Subject: [PATCH 11/19] Fix remote room membership handling Thanks anoa! Signed-off-by: Nicolas Werner --- synapse/handlers/room_summary.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index b8ecc4332cdf..052dd59e2e63 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -847,8 +847,17 @@ async def get_room_summary( # key. room.pop("allowed_room_ids", None) - # A remote room can't be in the joined state - room["membership"] = "leave" + # If there was a requester, add their membership. + # We keep the membership in the local membership table + # unless the room is purged even for remote rooms. + if requester: + ( + membership, + _, + ) = await self._store.get_local_current_membership_for_user_in_room( + requester, room_id + ) + room["membership"] = membership or "leave" return room From 6ff9873e18f06956b87de0eea66fbf6a5c82be53 Mon Sep 17 00:00:00 2001 From: "DeepBlueV7.X" Date: Wed, 4 May 2022 15:56:52 +0000 Subject: [PATCH 12/19] Update synapse/handlers/room_summary.py Co-authored-by: Patrick Cloke --- synapse/handlers/room_summary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 052dd59e2e63..16e5250f91fe 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -835,7 +835,7 @@ async def get_room_summary( fed_room_id = room_entry.room_id if fed_room_id == room_id: - # The results over federation might include rooms that the we, + # The results over federation might include rooms that we, # as the requesting server, are allowed to see, but the requesting # user is not permitted to see. # From 1318e6ba084e6372bf7d1bff750365bc72d7a3e0 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 4 May 2022 18:04:28 +0200 Subject: [PATCH 13/19] Don't overwrite cache entry by accident Signed-off-by: Nicolas Werner --- synapse/handlers/room_summary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 16e5250f91fe..427f97004029 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -831,7 +831,7 @@ async def get_room_summary( ) if room_entry: - room = room_entry.room + room = dict(room_entry.room) fed_room_id = room_entry.room_id if fed_room_id == room_id: From 433a39468763192c406790ecaffcd605243891fe Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 4 May 2022 18:12:56 +0200 Subject: [PATCH 14/19] Remove redundant room_id check Signed-off-by: Nicolas Werner --- synapse/handlers/room_summary.py | 49 +++++++++++++++----------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 427f97004029..06c6eaa4dc10 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -834,32 +834,29 @@ async def get_room_summary( room = dict(room_entry.room) fed_room_id = room_entry.room_id - if fed_room_id == room_id: - # The results over federation might include rooms that we, - # as the requesting server, are allowed to see, but the requesting - # user is not permitted to see. - # - # Filter the returned results to only what is accessible to the user. - if await self._is_remote_room_accessible( - requester, fed_room_id, room - ): - # Before returning to the client, remove the allowed_room_ids - # key. - room.pop("allowed_room_ids", None) - - # If there was a requester, add their membership. - # We keep the membership in the local membership table - # unless the room is purged even for remote rooms. - if requester: - ( - membership, - _, - ) = await self._store.get_local_current_membership_for_user_in_room( - requester, room_id - ) - room["membership"] = membership or "leave" - - return room + # The results over federation might include rooms that we, + # as the requesting server, are allowed to see, but the requesting + # user is not permitted to see. + # + # Filter the returned results to only what is accessible to the user. + if await self._is_remote_room_accessible(requester, fed_room_id, room): + # Before returning to the client, remove the allowed_room_ids + # key. + room.pop("allowed_room_ids", None) + + # If there was a requester, add their membership. + # We keep the membership in the local membership table + # unless the room is purged even for remote rooms. + if requester: + ( + membership, + _, + ) = await self._store.get_local_current_membership_for_user_in_room( + requester, room_id + ) + room["membership"] = membership or "leave" + + return room raise NotFoundError("Room not found or is not accessible") From 87bcc6f031bf35a2dd3eb1ece9f13b872a745a2f Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 4 May 2022 18:30:37 +0200 Subject: [PATCH 15/19] Add assert for returned hierarchy response to federation client Signed-off-by: Nicolas Werner --- synapse/federation/federation_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py index 6a59cb4b713e..5f5daa61ef61 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py @@ -1426,6 +1426,8 @@ async def send_request( room = res.get("room") if not isinstance(room, dict): raise InvalidResponseError("'room' must be a dict") + if not room.get("room_id") == room_id: + raise InvalidResponseError("wrong room returned in hierarchy response") # Validate children_state of the room. children_state = room.pop("children_state", []) From 0184eac0a06e4c4e358ce0ac9a1d8d8033f0aa18 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 4 May 2022 18:46:38 +0200 Subject: [PATCH 16/19] Move additional parameters in /hierarchy response behind unstable flag --- synapse/handlers/room_summary.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 06c6eaa4dc10..3c3604303495 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -105,6 +105,7 @@ def __init__(self, hs: "HomeServer"): hs.get_clock(), "get_room_hierarchy", ) + self._msc3266_enabled = hs.config.experimental.msc3266_enabled async def get_room_hierarchy( self, @@ -716,10 +717,12 @@ async def _build_room_entry(self, room_id: str, for_federation: bool) -> JsonDic ), "guest_can_join": stats["guest_access"] == "can_join", "room_type": create_event.content.get(EventContentFields.ROOM_TYPE), - "im.nheko.summary.version": stats["version"], - "im.nheko.summary.encryption": stats["encryption"], } + if self._msc3266_enabled: + entry["im.nheko.summary.version"] = stats["version"] + entry["im.nheko.summary.encryption"] = stats["encryption"] + # Federation requests need to provide additional information so the # requested server is able to filter the response appropriately. if for_federation: From a92d936485fd6ef4249ba169e6462a2ca1a09285 Mon Sep 17 00:00:00 2001 From: "DeepBlueV7.X" Date: Thu, 5 May 2022 12:11:32 +0000 Subject: [PATCH 17/19] Update synapse/federation/federation_client.py Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> --- synapse/federation/federation_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py index 5f5daa61ef61..b5e0b84cbc69 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py @@ -1426,7 +1426,7 @@ async def send_request( room = res.get("room") if not isinstance(room, dict): raise InvalidResponseError("'room' must be a dict") - if not room.get("room_id") == room_id: + if room.get("room_id") != room_id: raise InvalidResponseError("wrong room returned in hierarchy response") # Validate children_state of the room. From 5481e11b85ee9b6c7932e0e038d9e4ef827d9ffb Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 5 May 2022 14:30:20 +0200 Subject: [PATCH 18/19] Invert logic of room summary handler to reduce indentation --- synapse/handlers/room_summary.py | 49 +++++++++++++++----------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 3c3604303495..7f0e1d47b18f 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -833,35 +833,32 @@ async def get_room_summary( suggested_only=True, ) - if room_entry: - room = dict(room_entry.room) - fed_room_id = room_entry.room_id + # The results over federation might include rooms that we, + # as the requesting server, are allowed to see, but the requesting + # user is not permitted to see. + # + # Filter the returned results to only what is accessible to the user. + if not room_entry or not await self._is_remote_room_accessible( + requester, room_entry.room_id, room_entry.room + ): + raise NotFoundError("Room not found or is not accessible") - # The results over federation might include rooms that we, - # as the requesting server, are allowed to see, but the requesting - # user is not permitted to see. - # - # Filter the returned results to only what is accessible to the user. - if await self._is_remote_room_accessible(requester, fed_room_id, room): - # Before returning to the client, remove the allowed_room_ids - # key. - room.pop("allowed_room_ids", None) - - # If there was a requester, add their membership. - # We keep the membership in the local membership table - # unless the room is purged even for remote rooms. - if requester: - ( - membership, - _, - ) = await self._store.get_local_current_membership_for_user_in_room( - requester, room_id - ) - room["membership"] = membership or "leave" + room = dict(room_entry.room) + room.pop("allowed_room_ids", None) - return room + # If there was a requester, add their membership. + # We keep the membership in the local membership table + # unless the room is purged even for remote rooms. + if requester: + ( + membership, + _, + ) = await self._store.get_local_current_membership_for_user_in_room( + requester, room_id + ) + room["membership"] = membership or "leave" - raise NotFoundError("Room not found or is not accessible") + return room return room_summary From a0fb14487b0a5d7a12102880d12826faff211c93 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 5 May 2022 14:34:21 +0200 Subject: [PATCH 19/19] Reflow comments --- synapse/handlers/room_summary.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index 7f0e1d47b18f..ff24ec806357 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -833,9 +833,9 @@ async def get_room_summary( suggested_only=True, ) - # The results over federation might include rooms that we, - # as the requesting server, are allowed to see, but the requesting - # user is not permitted to see. + # The results over federation might include rooms that we, as the + # requesting server, are allowed to see, but the requesting user is + # not permitted to see. # # Filter the returned results to only what is accessible to the user. if not room_entry or not await self._is_remote_room_accessible( @@ -847,8 +847,8 @@ async def get_room_summary( room.pop("allowed_room_ids", None) # If there was a requester, add their membership. - # We keep the membership in the local membership table - # unless the room is purged even for remote rooms. + # We keep the membership in the local membership table unless the + # room is purged even for remote rooms. if requester: ( membership,