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

Commit

Permalink
Remove remaining bits of groups code. (#12936)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
clokep authored Jun 1, 2022
1 parent 88193f2 commit 7bc08f3
Show file tree
Hide file tree
Showing 19 changed files with 1 addition and 35 deletions.
1 change: 1 addition & 0 deletions changelog.d/12936.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove support for the non-standard groups/communities feature from Synapse.
6 changes: 0 additions & 6 deletions docs/workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ information.
^/_matrix/federation/v1/event_auth/
^/_matrix/federation/v1/exchange_third_party_invite/
^/_matrix/federation/v1/user/devices/
^/_matrix/federation/v1/get_groups_publicised$
^/_matrix/key/v2/query
^/_matrix/federation/v1/hierarchy/

Expand All @@ -213,9 +212,6 @@ information.
^/_matrix/client/(r0|v3|unstable)/devices$
^/_matrix/client/versions$
^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$
^/_matrix/client/(r0|v3|unstable)/joined_groups$
^/_matrix/client/(r0|v3|unstable)/publicised_groups$
^/_matrix/client/(r0|v3|unstable)/publicised_groups/
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$
^/_matrix/client/(api/v1|r0|v3|unstable)/search$
Expand Down Expand Up @@ -255,9 +251,7 @@ information.

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

^/_matrix/federation/v1/groups/
^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/
^/_matrix/client/(r0|v3|unstable)/groups/

Pagination requests can also be handled, but all requests for a given
room must be routed to the same instance. Additionally, care must be taken to
Expand Down
1 change: 0 additions & 1 deletion synapse/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class EventTypes:
Aliases: Final = "m.room.aliases"
Redaction: Final = "m.room.redaction"
ThirdPartyInvite: Final = "m.room.third_party_invite"
RelatedGroups: Final = "m.room.related_groups"

RoomHistoryVisibility: Final = "m.room.history_visibility"
CanonicalAlias: Final = "m.room.canonical_alias"
Expand Down
2 changes: 0 additions & 2 deletions synapse/appservice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class ApplicationService:
def __init__(
self,
token: str,
hostname: str,
id: str,
sender: str,
url: Optional[str] = None,
Expand All @@ -88,7 +87,6 @@ def __init__(
) # url must not end with a slash
self.hs_token = hs_token
self.sender = sender
self.server_name = hostname
self.namespaces = self._check_namespaces(namespaces)
self.id = id
self.ip_range_whitelist = ip_range_whitelist
Expand Down
1 change: 0 additions & 1 deletion synapse/config/appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ def _load_appservice(

return ApplicationService(
token=as_info["as_token"],
hostname=hostname,
url=as_info["url"],
namespaces=as_info["namespaces"],
hs_token=as_info["hs_token"],
Expand Down
1 change: 0 additions & 1 deletion synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ async def clone_existing_room(
(EventTypes.RoomAvatar, ""),
(EventTypes.RoomEncryption, ""),
(EventTypes.ServerACL, ""),
(EventTypes.RelatedGroups, ""),
(EventTypes.PowerLevels, ""),
]

Expand Down
4 changes: 0 additions & 4 deletions synapse/storage/databases/main/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,6 @@ async def get_local_media_before(
(SELECT 1
FROM profiles
WHERE profiles.avatar_url = '{media_prefix}' || lmr.media_id)
AND NOT EXISTS
(SELECT 1
FROM groups
WHERE groups.avatar_url = '{media_prefix}' || lmr.media_id)
AND NOT EXISTS
(SELECT 1
FROM room_memberships
Expand Down
2 changes: 0 additions & 2 deletions tests/api/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ def test_blocking_mau__appservice_requester_allowed_when_not_tracking_ips(self):

appservice = ApplicationService(
"abcd",
self.hs.config.server.server_name,
id="1234",
namespaces={
"users": [{"regex": "@_appservice.*:sender", "exclusive": True}]
Expand Down Expand Up @@ -433,7 +432,6 @@ def test_blocking_mau__appservice_requester_disallowed_when_tracking_ips(self):

appservice = ApplicationService(
"abcd",
self.hs.config.server.server_name,
id="1234",
namespaces={
"users": [{"regex": "@_appservice.*:sender", "exclusive": True}]
Expand Down
2 changes: 0 additions & 2 deletions tests/api/test_ratelimiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def test_allowed_via_can_do_action(self):
def test_allowed_appservice_ratelimited_via_can_requester_do_action(self):
appservice = ApplicationService(
None,
"example.com",
id="foo",
rate_limited=True,
sender="@as:example.com",
Expand Down Expand Up @@ -62,7 +61,6 @@ def test_allowed_appservice_ratelimited_via_can_requester_do_action(self):
def test_allowed_appservice_via_can_requester_do_action(self):
appservice = ApplicationService(
None,
"example.com",
id="foo",
rate_limited=False,
sender="@as:example.com",
Expand Down
1 change: 0 additions & 1 deletion tests/appservice/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer):
url=URL,
token="unused",
hs_token=TOKEN,
hostname="myserver",
)

def test_query_3pe_authenticates_token(self):
Expand Down
1 change: 0 additions & 1 deletion tests/appservice/test_appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def setUp(self):
sender="@as:test",
url="some_url",
token="some_token",
hostname="matrix.org", # only used by get_groups_for_user
)
self.event = Mock(
event_id="$abc:xyz",
Expand Down
3 changes: 0 additions & 3 deletions tests/handlers/test_appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,6 @@ def _register_application_service(
# Create an application service
appservice = ApplicationService(
token=random_string(10),
hostname="example.com",
id=random_string(10),
sender="@as:example.com",
rate_limited=False,
Expand Down Expand Up @@ -776,7 +775,6 @@ def test_application_service_receives_device_list_updates(
# Create an appservice that is interested in "local_user"
appservice = ApplicationService(
token=random_string(10),
hostname="example.com",
id=random_string(10),
sender="@as:example.com",
rate_limited=False,
Expand Down Expand Up @@ -843,7 +841,6 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
self._service_token = "VERYSECRET"
self._service = ApplicationService(
self._service_token,
"as1.invalid",
"as1",
"@as.sender:test",
namespaces={
Expand Down
1 change: 0 additions & 1 deletion tests/handlers/test_user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:

self.appservice = ApplicationService(
token="i_am_an_app_service",
hostname="test",
id="1234",
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
# Note: this user does not match the regex above, so that tests
Expand Down
1 change: 0 additions & 1 deletion tests/rest/client/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ def test_GET_whoami_appservices(self) -> None:

appservice = ApplicationService(
as_token,
self.hs.config.server.server_name,
id="1234",
namespaces={"users": [{"regex": user_id, "exclusive": True}]},
sender=user_id,
Expand Down
2 changes: 0 additions & 2 deletions tests/rest/client/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,6 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
self.service = ApplicationService(
id="unique_identifier",
token="some_token",
hostname="example.com",
sender="@asbot:example.com",
namespaces={
ApplicationService.NS_USERS: [
Expand All @@ -1125,7 +1124,6 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
self.another_service = ApplicationService(
id="another__identifier",
token="another_token",
hostname="example.com",
sender="@as2bot:example.com",
namespaces={
ApplicationService.NS_USERS: [
Expand Down
2 changes: 0 additions & 2 deletions tests/rest/client/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def test_POST_appservice_registration_valid(self) -> None:

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

appservice = ApplicationService(
as_token,
self.hs.config.server.server_name,
id="1234",
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
sender="@as:test",
Expand Down
1 change: 0 additions & 1 deletion tests/rest/client/test_room_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:

self.appservice = ApplicationService(
token="i_am_an_app_service",
hostname="test",
id="1234",
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
# Note: this user does not have to match the regex above
Expand Down
1 change: 0 additions & 1 deletion tests/storage/test_user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ class UserDirectoryInitialPopulationTestcase(HomeserverTestCase):
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
self.appservice = ApplicationService(
token="i_am_an_app_service",
hostname="test",
id="1234",
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
sender="@as:test",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_mau.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def test_as_ignores_mau(self):
self.store.services_cache.append(
ApplicationService(
token=as_token,
hostname=self.hs.hostname,
id="SomeASID",
sender="@as_sender:test",
namespaces={"users": [{"regex": "@as_*", "exclusive": True}]},
Expand Down Expand Up @@ -251,7 +250,6 @@ def advance_time_and_sync():
self.store.services_cache.append(
ApplicationService(
token=as_token_1,
hostname=self.hs.hostname,
id="SomeASID",
sender="@as_sender_1:test",
namespaces={"users": [{"regex": "@as_1.*", "exclusive": True}]},
Expand All @@ -262,7 +260,6 @@ def advance_time_and_sync():
self.store.services_cache.append(
ApplicationService(
token=as_token_2,
hostname=self.hs.hostname,
id="AnotherASID",
sender="@as_sender_2:test",
namespaces={"users": [{"regex": "@as_2.*", "exclusive": True}]},
Expand Down

0 comments on commit 7bc08f3

Please sign in to comment.