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.
This commit is contained in:
Patrick Cloke 2022-06-01 09:41:25 -04:00 committed by GitHub
parent 88193f2125
commit 7bc08f3201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 1 additions and 35 deletions

View File

@ -0,0 +1 @@
Remove support for the non-standard groups/communities feature from Synapse.

View File

@ -191,7 +191,6 @@ information.
^/_matrix/federation/v1/event_auth/ ^/_matrix/federation/v1/event_auth/
^/_matrix/federation/v1/exchange_third_party_invite/ ^/_matrix/federation/v1/exchange_third_party_invite/
^/_matrix/federation/v1/user/devices/ ^/_matrix/federation/v1/user/devices/
^/_matrix/federation/v1/get_groups_publicised$
^/_matrix/key/v2/query ^/_matrix/key/v2/query
^/_matrix/federation/v1/hierarchy/ ^/_matrix/federation/v1/hierarchy/
@ -213,9 +212,6 @@ information.
^/_matrix/client/(r0|v3|unstable)/devices$ ^/_matrix/client/(r0|v3|unstable)/devices$
^/_matrix/client/versions$ ^/_matrix/client/versions$
^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$ ^/_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)/rooms/.*/event/
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$ ^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$
^/_matrix/client/(api/v1|r0|v3|unstable)/search$ ^/_matrix/client/(api/v1|r0|v3|unstable)/search$
@ -255,9 +251,7 @@ information.
Additionally, the following REST endpoints can be handled for GET requests: 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/(api/v1|r0|v3|unstable)/pushrules/
^/_matrix/client/(r0|v3|unstable)/groups/
Pagination requests can also be handled, but all requests for a given 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 room must be routed to the same instance. Additionally, care must be taken to

View File

@ -95,7 +95,6 @@ class EventTypes:
Aliases: Final = "m.room.aliases" Aliases: Final = "m.room.aliases"
Redaction: Final = "m.room.redaction" Redaction: Final = "m.room.redaction"
ThirdPartyInvite: Final = "m.room.third_party_invite" ThirdPartyInvite: Final = "m.room.third_party_invite"
RelatedGroups: Final = "m.room.related_groups"
RoomHistoryVisibility: Final = "m.room.history_visibility" RoomHistoryVisibility: Final = "m.room.history_visibility"
CanonicalAlias: Final = "m.room.canonical_alias" CanonicalAlias: Final = "m.room.canonical_alias"

View File

@ -70,7 +70,6 @@ class ApplicationService:
def __init__( def __init__(
self, self,
token: str, token: str,
hostname: str,
id: str, id: str,
sender: str, sender: str,
url: Optional[str] = None, url: Optional[str] = None,
@ -88,7 +87,6 @@ class ApplicationService:
) # url must not end with a slash ) # url must not end with a slash
self.hs_token = hs_token self.hs_token = hs_token
self.sender = sender self.sender = sender
self.server_name = hostname
self.namespaces = self._check_namespaces(namespaces) self.namespaces = self._check_namespaces(namespaces)
self.id = id self.id = id
self.ip_range_whitelist = ip_range_whitelist self.ip_range_whitelist = ip_range_whitelist

View File

@ -179,7 +179,6 @@ def _load_appservice(
return ApplicationService( return ApplicationService(
token=as_info["as_token"], token=as_info["as_token"],
hostname=hostname,
url=as_info["url"], url=as_info["url"],
namespaces=as_info["namespaces"], namespaces=as_info["namespaces"],
hs_token=as_info["hs_token"], hs_token=as_info["hs_token"],

View File

@ -468,7 +468,6 @@ class RoomCreationHandler:
(EventTypes.RoomAvatar, ""), (EventTypes.RoomAvatar, ""),
(EventTypes.RoomEncryption, ""), (EventTypes.RoomEncryption, ""),
(EventTypes.ServerACL, ""), (EventTypes.ServerACL, ""),
(EventTypes.RelatedGroups, ""),
(EventTypes.PowerLevels, ""), (EventTypes.PowerLevels, ""),
] ]

View File

@ -276,10 +276,6 @@ class MediaRepositoryStore(MediaRepositoryBackgroundUpdateStore):
(SELECT 1 (SELECT 1
FROM profiles FROM profiles
WHERE profiles.avatar_url = '{media_prefix}' || lmr.media_id) 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 AND NOT EXISTS
(SELECT 1 (SELECT 1
FROM room_memberships FROM room_memberships

View File

@ -404,7 +404,6 @@ class AuthTestCase(unittest.HomeserverTestCase):
appservice = ApplicationService( appservice = ApplicationService(
"abcd", "abcd",
self.hs.config.server.server_name,
id="1234", id="1234",
namespaces={ namespaces={
"users": [{"regex": "@_appservice.*:sender", "exclusive": True}] "users": [{"regex": "@_appservice.*:sender", "exclusive": True}]
@ -433,7 +432,6 @@ class AuthTestCase(unittest.HomeserverTestCase):
appservice = ApplicationService( appservice = ApplicationService(
"abcd", "abcd",
self.hs.config.server.server_name,
id="1234", id="1234",
namespaces={ namespaces={
"users": [{"regex": "@_appservice.*:sender", "exclusive": True}] "users": [{"regex": "@_appservice.*:sender", "exclusive": True}]

View File

@ -31,7 +31,6 @@ class TestRatelimiter(unittest.HomeserverTestCase):
def test_allowed_appservice_ratelimited_via_can_requester_do_action(self): def test_allowed_appservice_ratelimited_via_can_requester_do_action(self):
appservice = ApplicationService( appservice = ApplicationService(
None, None,
"example.com",
id="foo", id="foo",
rate_limited=True, rate_limited=True,
sender="@as:example.com", sender="@as:example.com",
@ -62,7 +61,6 @@ class TestRatelimiter(unittest.HomeserverTestCase):
def test_allowed_appservice_via_can_requester_do_action(self): def test_allowed_appservice_via_can_requester_do_action(self):
appservice = ApplicationService( appservice = ApplicationService(
None, None,
"example.com",
id="foo", id="foo",
rate_limited=False, rate_limited=False,
sender="@as:example.com", sender="@as:example.com",

View File

@ -37,7 +37,6 @@ class ApplicationServiceApiTestCase(unittest.HomeserverTestCase):
url=URL, url=URL,
token="unused", token="unused",
hs_token=TOKEN, hs_token=TOKEN,
hostname="myserver",
) )
def test_query_3pe_authenticates_token(self): def test_query_3pe_authenticates_token(self):

View File

@ -33,7 +33,6 @@ class ApplicationServiceTestCase(unittest.TestCase):
sender="@as:test", sender="@as:test",
url="some_url", url="some_url",
token="some_token", token="some_token",
hostname="matrix.org", # only used by get_groups_for_user
) )
self.event = Mock( self.event = Mock(
event_id="$abc:xyz", event_id="$abc:xyz",

View File

@ -697,7 +697,6 @@ class ApplicationServicesHandlerSendEventsTestCase(unittest.HomeserverTestCase):
# Create an application service # Create an application service
appservice = ApplicationService( appservice = ApplicationService(
token=random_string(10), token=random_string(10),
hostname="example.com",
id=random_string(10), id=random_string(10),
sender="@as:example.com", sender="@as:example.com",
rate_limited=False, rate_limited=False,
@ -776,7 +775,6 @@ class ApplicationServicesHandlerDeviceListsTestCase(unittest.HomeserverTestCase)
# Create an appservice that is interested in "local_user" # Create an appservice that is interested in "local_user"
appservice = ApplicationService( appservice = ApplicationService(
token=random_string(10), token=random_string(10),
hostname="example.com",
id=random_string(10), id=random_string(10),
sender="@as:example.com", sender="@as:example.com",
rate_limited=False, rate_limited=False,
@ -843,7 +841,6 @@ class ApplicationServicesHandlerOtkCountsTestCase(unittest.HomeserverTestCase):
self._service_token = "VERYSECRET" self._service_token = "VERYSECRET"
self._service = ApplicationService( self._service = ApplicationService(
self._service_token, self._service_token,
"as1.invalid",
"as1", "as1",
"@as.sender:test", "@as.sender:test",
namespaces={ namespaces={

View File

@ -60,7 +60,6 @@ class UserDirectoryTestCase(unittest.HomeserverTestCase):
self.appservice = ApplicationService( self.appservice = ApplicationService(
token="i_am_an_app_service", token="i_am_an_app_service",
hostname="test",
id="1234", id="1234",
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]}, namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
# Note: this user does not match the regex above, so that tests # Note: this user does not match the regex above, so that tests

View File

@ -548,7 +548,6 @@ class WhoamiTestCase(unittest.HomeserverTestCase):
appservice = ApplicationService( appservice = ApplicationService(
as_token, as_token,
self.hs.config.server.server_name,
id="1234", id="1234",
namespaces={"users": [{"regex": user_id, "exclusive": True}]}, namespaces={"users": [{"regex": user_id, "exclusive": True}]},
sender=user_id, sender=user_id,

View File

@ -1112,7 +1112,6 @@ class AppserviceLoginRestServletTestCase(unittest.HomeserverTestCase):
self.service = ApplicationService( self.service = ApplicationService(
id="unique_identifier", id="unique_identifier",
token="some_token", token="some_token",
hostname="example.com",
sender="@asbot:example.com", sender="@asbot:example.com",
namespaces={ namespaces={
ApplicationService.NS_USERS: [ ApplicationService.NS_USERS: [
@ -1125,7 +1124,6 @@ class AppserviceLoginRestServletTestCase(unittest.HomeserverTestCase):
self.another_service = ApplicationService( self.another_service = ApplicationService(
id="another__identifier", id="another__identifier",
token="another_token", token="another_token",
hostname="example.com",
sender="@as2bot:example.com", sender="@as2bot:example.com",
namespaces={ namespaces={
ApplicationService.NS_USERS: [ ApplicationService.NS_USERS: [

View File

@ -56,7 +56,6 @@ class RegisterRestServletTestCase(unittest.HomeserverTestCase):
appservice = ApplicationService( appservice = ApplicationService(
as_token, as_token,
self.hs.config.server.server_name,
id="1234", id="1234",
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]}, namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
sender="@as:test", sender="@as:test",
@ -80,7 +79,6 @@ class RegisterRestServletTestCase(unittest.HomeserverTestCase):
appservice = ApplicationService( appservice = ApplicationService(
as_token, as_token,
self.hs.config.server.server_name,
id="1234", id="1234",
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]}, namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
sender="@as:test", sender="@as:test",

View File

@ -71,7 +71,6 @@ class RoomBatchTestCase(unittest.HomeserverTestCase):
self.appservice = ApplicationService( self.appservice = ApplicationService(
token="i_am_an_app_service", token="i_am_an_app_service",
hostname="test",
id="1234", id="1234",
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]}, namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
# Note: this user does not have to match the regex above # Note: this user does not have to match the regex above

View File

@ -134,7 +134,6 @@ class UserDirectoryInitialPopulationTestcase(HomeserverTestCase):
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer: def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
self.appservice = ApplicationService( self.appservice = ApplicationService(
token="i_am_an_app_service", token="i_am_an_app_service",
hostname="test",
id="1234", id="1234",
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]}, namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
sender="@as:test", sender="@as:test",

View File

@ -105,7 +105,6 @@ class TestMauLimit(unittest.HomeserverTestCase):
self.store.services_cache.append( self.store.services_cache.append(
ApplicationService( ApplicationService(
token=as_token, token=as_token,
hostname=self.hs.hostname,
id="SomeASID", id="SomeASID",
sender="@as_sender:test", sender="@as_sender:test",
namespaces={"users": [{"regex": "@as_*", "exclusive": True}]}, namespaces={"users": [{"regex": "@as_*", "exclusive": True}]},
@ -251,7 +250,6 @@ class TestMauLimit(unittest.HomeserverTestCase):
self.store.services_cache.append( self.store.services_cache.append(
ApplicationService( ApplicationService(
token=as_token_1, token=as_token_1,
hostname=self.hs.hostname,
id="SomeASID", id="SomeASID",
sender="@as_sender_1:test", sender="@as_sender_1:test",
namespaces={"users": [{"regex": "@as_1.*", "exclusive": True}]}, namespaces={"users": [{"regex": "@as_1.*", "exclusive": True}]},
@ -262,7 +260,6 @@ class TestMauLimit(unittest.HomeserverTestCase):
self.store.services_cache.append( self.store.services_cache.append(
ApplicationService( ApplicationService(
token=as_token_2, token=as_token_2,
hostname=self.hs.hostname,
id="AnotherASID", id="AnotherASID",
sender="@as_sender_2:test", sender="@as_sender_2:test",
namespaces={"users": [{"regex": "@as_2.*", "exclusive": True}]}, namespaces={"users": [{"regex": "@as_2.*", "exclusive": True}]},