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

Commit 7bc08f3

Browse files
authored
Remove remaining bits of groups code. (#12936)
* Update worker docs to remove group endpoints. * Removes an unused parameter to `ApplicationService`. * Break dependency between media repo and groups. * Avoid copying `m.room.related_groups` state events during room upgrades.
1 parent 88193f2 commit 7bc08f3

19 files changed

+1
-35
lines changed

changelog.d/12936.removal

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove support for the non-standard groups/communities feature from Synapse.

docs/workers.md

-6
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ information.
191191
^/_matrix/federation/v1/event_auth/
192192
^/_matrix/federation/v1/exchange_third_party_invite/
193193
^/_matrix/federation/v1/user/devices/
194-
^/_matrix/federation/v1/get_groups_publicised$
195194
^/_matrix/key/v2/query
196195
^/_matrix/federation/v1/hierarchy/
197196

@@ -213,9 +212,6 @@ information.
213212
^/_matrix/client/(r0|v3|unstable)/devices$
214213
^/_matrix/client/versions$
215214
^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$
216-
^/_matrix/client/(r0|v3|unstable)/joined_groups$
217-
^/_matrix/client/(r0|v3|unstable)/publicised_groups$
218-
^/_matrix/client/(r0|v3|unstable)/publicised_groups/
219215
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/
220216
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$
221217
^/_matrix/client/(api/v1|r0|v3|unstable)/search$
@@ -255,9 +251,7 @@ information.
255251

256252
Additionally, the following REST endpoints can be handled for GET requests:
257253

258-
^/_matrix/federation/v1/groups/
259254
^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/
260-
^/_matrix/client/(r0|v3|unstable)/groups/
261255

262256
Pagination requests can also be handled, but all requests for a given
263257
room must be routed to the same instance. Additionally, care must be taken to

synapse/api/constants.py

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class EventTypes:
9595
Aliases: Final = "m.room.aliases"
9696
Redaction: Final = "m.room.redaction"
9797
ThirdPartyInvite: Final = "m.room.third_party_invite"
98-
RelatedGroups: Final = "m.room.related_groups"
9998

10099
RoomHistoryVisibility: Final = "m.room.history_visibility"
101100
CanonicalAlias: Final = "m.room.canonical_alias"

synapse/appservice/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class ApplicationService:
7070
def __init__(
7171
self,
7272
token: str,
73-
hostname: str,
7473
id: str,
7574
sender: str,
7675
url: Optional[str] = None,
@@ -88,7 +87,6 @@ def __init__(
8887
) # url must not end with a slash
8988
self.hs_token = hs_token
9089
self.sender = sender
91-
self.server_name = hostname
9290
self.namespaces = self._check_namespaces(namespaces)
9391
self.id = id
9492
self.ip_range_whitelist = ip_range_whitelist

synapse/config/appservice.py

-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def _load_appservice(
179179

180180
return ApplicationService(
181181
token=as_info["as_token"],
182-
hostname=hostname,
183182
url=as_info["url"],
184183
namespaces=as_info["namespaces"],
185184
hs_token=as_info["hs_token"],

synapse/handlers/room.py

-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ async def clone_existing_room(
468468
(EventTypes.RoomAvatar, ""),
469469
(EventTypes.RoomEncryption, ""),
470470
(EventTypes.ServerACL, ""),
471-
(EventTypes.RelatedGroups, ""),
472471
(EventTypes.PowerLevels, ""),
473472
]
474473

synapse/storage/databases/main/media_repository.py

-4
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,6 @@ async def get_local_media_before(
276276
(SELECT 1
277277
FROM profiles
278278
WHERE profiles.avatar_url = '{media_prefix}' || lmr.media_id)
279-
AND NOT EXISTS
280-
(SELECT 1
281-
FROM groups
282-
WHERE groups.avatar_url = '{media_prefix}' || lmr.media_id)
283279
AND NOT EXISTS
284280
(SELECT 1
285281
FROM room_memberships

tests/api/test_auth.py

-2
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ def test_blocking_mau__appservice_requester_allowed_when_not_tracking_ips(self):
404404

405405
appservice = ApplicationService(
406406
"abcd",
407-
self.hs.config.server.server_name,
408407
id="1234",
409408
namespaces={
410409
"users": [{"regex": "@_appservice.*:sender", "exclusive": True}]
@@ -433,7 +432,6 @@ def test_blocking_mau__appservice_requester_disallowed_when_tracking_ips(self):
433432

434433
appservice = ApplicationService(
435434
"abcd",
436-
self.hs.config.server.server_name,
437435
id="1234",
438436
namespaces={
439437
"users": [{"regex": "@_appservice.*:sender", "exclusive": True}]

tests/api/test_ratelimiting.py

-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def test_allowed_via_can_do_action(self):
3131
def test_allowed_appservice_ratelimited_via_can_requester_do_action(self):
3232
appservice = ApplicationService(
3333
None,
34-
"example.com",
3534
id="foo",
3635
rate_limited=True,
3736
sender="@as:example.com",
@@ -62,7 +61,6 @@ def test_allowed_appservice_ratelimited_via_can_requester_do_action(self):
6261
def test_allowed_appservice_via_can_requester_do_action(self):
6362
appservice = ApplicationService(
6463
None,
65-
"example.com",
6664
id="foo",
6765
rate_limited=False,
6866
sender="@as:example.com",

tests/appservice/test_api.py

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer):
3737
url=URL,
3838
token="unused",
3939
hs_token=TOKEN,
40-
hostname="myserver",
4140
)
4241

4342
def test_query_3pe_authenticates_token(self):

tests/appservice/test_appservice.py

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def setUp(self):
3333
sender="@as:test",
3434
url="some_url",
3535
token="some_token",
36-
hostname="matrix.org", # only used by get_groups_for_user
3736
)
3837
self.event = Mock(
3938
event_id="$abc:xyz",

tests/handlers/test_appservice.py

-3
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ def _register_application_service(
697697
# Create an application service
698698
appservice = ApplicationService(
699699
token=random_string(10),
700-
hostname="example.com",
701700
id=random_string(10),
702701
sender="@as:example.com",
703702
rate_limited=False,
@@ -776,7 +775,6 @@ def test_application_service_receives_device_list_updates(
776775
# Create an appservice that is interested in "local_user"
777776
appservice = ApplicationService(
778777
token=random_string(10),
779-
hostname="example.com",
780778
id=random_string(10),
781779
sender="@as:example.com",
782780
rate_limited=False,
@@ -843,7 +841,6 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
843841
self._service_token = "VERYSECRET"
844842
self._service = ApplicationService(
845843
self._service_token,
846-
"as1.invalid",
847844
"as1",
848845
"@as.sender:test",
849846
namespaces={

tests/handlers/test_user_directory.py

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
6060

6161
self.appservice = ApplicationService(
6262
token="i_am_an_app_service",
63-
hostname="test",
6463
id="1234",
6564
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
6665
# Note: this user does not match the regex above, so that tests

tests/rest/client/test_account.py

-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,6 @@ def test_GET_whoami_appservices(self) -> None:
548548

549549
appservice = ApplicationService(
550550
as_token,
551-
self.hs.config.server.server_name,
552551
id="1234",
553552
namespaces={"users": [{"regex": user_id, "exclusive": True}]},
554553
sender=user_id,

tests/rest/client/test_login.py

-2
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,6 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
11121112
self.service = ApplicationService(
11131113
id="unique_identifier",
11141114
token="some_token",
1115-
hostname="example.com",
11161115
sender="@asbot:example.com",
11171116
namespaces={
11181117
ApplicationService.NS_USERS: [
@@ -1125,7 +1124,6 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
11251124
self.another_service = ApplicationService(
11261125
id="another__identifier",
11271126
token="another_token",
1128-
hostname="example.com",
11291127
sender="@as2bot:example.com",
11301128
namespaces={
11311129
ApplicationService.NS_USERS: [

tests/rest/client/test_register.py

-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def test_POST_appservice_registration_valid(self) -> None:
5656

5757
appservice = ApplicationService(
5858
as_token,
59-
self.hs.config.server.server_name,
6059
id="1234",
6160
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
6261
sender="@as:test",
@@ -80,7 +79,6 @@ def test_POST_appservice_registration_no_type(self) -> None:
8079

8180
appservice = ApplicationService(
8281
as_token,
83-
self.hs.config.server.server_name,
8482
id="1234",
8583
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
8684
sender="@as:test",

tests/rest/client/test_room_batch.py

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
7171

7272
self.appservice = ApplicationService(
7373
token="i_am_an_app_service",
74-
hostname="test",
7574
id="1234",
7675
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
7776
# Note: this user does not have to match the regex above

tests/storage/test_user_directory.py

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ class UserDirectoryInitialPopulationTestcase(HomeserverTestCase):
134134
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
135135
self.appservice = ApplicationService(
136136
token="i_am_an_app_service",
137-
hostname="test",
138137
id="1234",
139138
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
140139
sender="@as:test",

tests/test_mau.py

-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def test_as_ignores_mau(self):
105105
self.store.services_cache.append(
106106
ApplicationService(
107107
token=as_token,
108-
hostname=self.hs.hostname,
109108
id="SomeASID",
110109
sender="@as_sender:test",
111110
namespaces={"users": [{"regex": "@as_*", "exclusive": True}]},
@@ -251,7 +250,6 @@ def advance_time_and_sync():
251250
self.store.services_cache.append(
252251
ApplicationService(
253252
token=as_token_1,
254-
hostname=self.hs.hostname,
255253
id="SomeASID",
256254
sender="@as_sender_1:test",
257255
namespaces={"users": [{"regex": "@as_1.*", "exclusive": True}]},
@@ -262,7 +260,6 @@ def advance_time_and_sync():
262260
self.store.services_cache.append(
263261
ApplicationService(
264262
token=as_token_2,
265-
hostname=self.hs.hostname,
266263
id="AnotherASID",
267264
sender="@as_sender_2:test",
268265
namespaces={"users": [{"regex": "@as_2.*", "exclusive": True}]},

0 commit comments

Comments
 (0)