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

Commit 1885ee0

Browse files
authored
Remove unstable APIs for /hierarchy. (#12851)
Removes the unstable endpoint as well as a duplicated field which was modified during stabilization.
1 parent b5707ce commit 1885ee0

File tree

6 files changed

+16
-28
lines changed

6 files changed

+16
-28
lines changed

changelog.d/12851.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove the unstable `/hierarchy` endpoint from [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946).

docs/workers.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ information.
193193
^/_matrix/federation/v1/user/devices/
194194
^/_matrix/federation/v1/get_groups_publicised$
195195
^/_matrix/key/v2/query
196-
^/_matrix/federation/(v1|unstable/org.matrix.msc2946)/hierarchy/
196+
^/_matrix/federation/v1/hierarchy/
197197

198198
# Inbound federation transaction request
199199
^/_matrix/federation/v1/send/
@@ -205,8 +205,8 @@ information.
205205
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*$
206206
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members$
207207
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state$
208-
^/_matrix/client/(v1|unstable/org.matrix.msc2946)/rooms/.*/hierarchy$
209-
^/_matrix/client/(v1|unstable/org.matrix.msc2716)/rooms/.*/batch_send$
208+
^/_matrix/client/v1/rooms/.*/hierarchy$
209+
^/_matrix/client/unstable/org.matrix.msc2716/rooms/.*/batch_send$
210210
^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$
211211
^/_matrix/client/(r0|v3|unstable)/account/3pid$
212212
^/_matrix/client/(r0|v3|unstable)/account/whoami$

synapse/federation/transport/server/federation.py

-5
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,6 @@ async def on_GET(
650650
)
651651

652652

653-
class FederationRoomHierarchyUnstableServlet(FederationRoomHierarchyServlet):
654-
PREFIX = FEDERATION_UNSTABLE_PREFIX + "/org.matrix.msc2946"
655-
656-
657653
class RoomComplexityServlet(BaseFederationServlet):
658654
"""
659655
Indicates to other servers how complex (and therefore likely
@@ -752,7 +748,6 @@ async def on_POST(
752748
FederationVersionServlet,
753749
RoomComplexityServlet,
754750
FederationRoomHierarchyServlet,
755-
FederationRoomHierarchyUnstableServlet,
756751
FederationV1SendKnockServlet,
757752
FederationMakeKnockServlet,
758753
FederationAccountStatusServlet,

synapse/handlers/room_summary.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ async def _is_remote_room_accessible(
662662
# The API doesn't return the room version so assume that a
663663
# join rule of knock is valid.
664664
if (
665-
room.get("join_rules")
665+
room.get("join_rule")
666666
in (JoinRules.PUBLIC, JoinRules.KNOCK, JoinRules.KNOCK_RESTRICTED)
667667
or room.get("world_readable") is True
668668
):
@@ -714,9 +714,6 @@ async def _build_room_entry(self, room_id: str, for_federation: bool) -> JsonDic
714714
"canonical_alias": stats["canonical_alias"],
715715
"num_joined_members": stats["joined_members"],
716716
"avatar_url": stats["avatar"],
717-
# plural join_rules is a documentation error but kept for historical
718-
# purposes. Should match /publicRooms.
719-
"join_rules": stats["join_rules"],
720717
"join_rule": stats["join_rules"],
721718
"world_readable": (
722719
stats["history_visibility"] == HistoryVisibility.WORLD_READABLE

synapse/rest/client/room.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1193,12 +1193,7 @@ async def on_GET(
11931193

11941194

11951195
class RoomHierarchyRestServlet(RestServlet):
1196-
PATTERNS = (
1197-
re.compile(
1198-
"^/_matrix/client/(v1|unstable/org.matrix.msc2946)"
1199-
"/rooms/(?P<room_id>[^/]*)/hierarchy$"
1200-
),
1201-
)
1196+
PATTERNS = (re.compile("^/_matrix/client/v1/rooms/(?P<room_id>[^/]*)/hierarchy$"),)
12021197

12031198
def __init__(self, hs: "HomeServer"):
12041199
super().__init__()

tests/handlers/test_room_summary.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _assert_hierarchy(
179179
result_children_ids.append(
180180
[
181181
(cs["room_id"], cs["state_key"])
182-
for cs in result_room.get("children_state")
182+
for cs in result_room["children_state"]
183183
]
184184
)
185185

@@ -772,39 +772,39 @@ def test_fed_filtering(self):
772772
{
773773
"room_id": public_room,
774774
"world_readable": False,
775-
"join_rules": JoinRules.PUBLIC,
775+
"join_rule": JoinRules.PUBLIC,
776776
},
777777
),
778778
(
779779
knock_room,
780780
{
781781
"room_id": knock_room,
782782
"world_readable": False,
783-
"join_rules": JoinRules.KNOCK,
783+
"join_rule": JoinRules.KNOCK,
784784
},
785785
),
786786
(
787787
not_invited_room,
788788
{
789789
"room_id": not_invited_room,
790790
"world_readable": False,
791-
"join_rules": JoinRules.INVITE,
791+
"join_rule": JoinRules.INVITE,
792792
},
793793
),
794794
(
795795
invited_room,
796796
{
797797
"room_id": invited_room,
798798
"world_readable": False,
799-
"join_rules": JoinRules.INVITE,
799+
"join_rule": JoinRules.INVITE,
800800
},
801801
),
802802
(
803803
restricted_room,
804804
{
805805
"room_id": restricted_room,
806806
"world_readable": False,
807-
"join_rules": JoinRules.RESTRICTED,
807+
"join_rule": JoinRules.RESTRICTED,
808808
"allowed_room_ids": [],
809809
},
810810
),
@@ -813,7 +813,7 @@ def test_fed_filtering(self):
813813
{
814814
"room_id": restricted_accessible_room,
815815
"world_readable": False,
816-
"join_rules": JoinRules.RESTRICTED,
816+
"join_rule": JoinRules.RESTRICTED,
817817
"allowed_room_ids": [self.room],
818818
},
819819
),
@@ -822,15 +822,15 @@ def test_fed_filtering(self):
822822
{
823823
"room_id": world_readable_room,
824824
"world_readable": True,
825-
"join_rules": JoinRules.INVITE,
825+
"join_rule": JoinRules.INVITE,
826826
},
827827
),
828828
(
829829
joined_room,
830830
{
831831
"room_id": joined_room,
832832
"world_readable": False,
833-
"join_rules": JoinRules.INVITE,
833+
"join_rule": JoinRules.INVITE,
834834
},
835835
),
836836
)
@@ -911,7 +911,7 @@ def test_fed_invited(self):
911911
{
912912
"room_id": fed_room,
913913
"world_readable": False,
914-
"join_rules": JoinRules.INVITE,
914+
"join_rule": JoinRules.INVITE,
915915
},
916916
)
917917

0 commit comments

Comments
 (0)