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

Commit

Permalink
Deprecate the groups/communities endpoints and add an experimental co…
Browse files Browse the repository at this point in the history
…nfiguration flag.
  • Loading branch information
clokep committed Mar 10, 2022
1 parent 72e7f1c commit e3a3a1e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.d/12200.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The groups/communities feature in Synapse has been deprecated.
14 changes: 14 additions & 0 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ process, for example:
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
```

# Upgrading to v1.56.0

## Groups/communities feature has been deprecated

The non-standard groups/communities feature in Synapse has been deprecated and will
be disabled by default in Synapse v1.58.0.

You can test disabling it by adding the following to your homeserver configuration:

```yaml
experimental_features:
groups_enabled: false
```

# Upgrading to v1.55.0

## `synctl` script has been moved
Expand Down
3 changes: 2 additions & 1 deletion synapse/app/generic_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ def _listen_http(self, listener_config: ListenerConfig) -> None:

presence.register_servlets(self, resource)

groups.register_servlets(self, resource)
if self.config.experimental.groups_enabled:
groups.register_servlets(self, resource)

resources.update({CLIENT_API_PREFIX: resource})

Expand Down
3 changes: 3 additions & 0 deletions synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@ def read_config(self, config: JsonDict, **kwargs):

# MSC3720 (Account status endpoint)
self.msc3720_enabled: bool = experimental.get("msc3720_enabled", False)

# The deprecated groups feature.
self.groups_enabled: bool = experimental.get("groups_enabled", True)
15 changes: 11 additions & 4 deletions synapse/federation/transport/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ async def on_GET(
return 200, {"sub": user_id}


DEFAULT_SERVLET_GROUPS: Dict[str, Iterable[Type[BaseFederationServlet]]] = {
SERVLET_GROUPS: Dict[str, Iterable[Type[BaseFederationServlet]]] = {
"federation": FEDERATION_SERVLET_CLASSES,
"room_list": (PublicRoomList,),
"group_server": GROUP_SERVER_SERVLET_CLASSES,
Expand All @@ -298,6 +298,10 @@ async def on_GET(
"openid": (OpenIdUserInfo,),
}

DEFAULT_SERVLET_GROUPS = ("federation", "room_list", "open_id")

GROUP_SERVLET_GROUPS = ("group_server", "group_local", "group_attestation")


def register_servlets(
hs: "HomeServer",
Expand All @@ -320,16 +324,19 @@ def register_servlets(
Defaults to ``DEFAULT_SERVLET_GROUPS``.
"""
if not servlet_groups:
servlet_groups = DEFAULT_SERVLET_GROUPS.keys()
servlet_groups = DEFAULT_SERVLET_GROUPS
# Only allow the groups servlets if the deprecated groups feature is enabled.
if hs.config.experimental.groups_enabled:
servlet_groups = servlet_groups + GROUP_SERVLET_GROUPS

for servlet_group in servlet_groups:
# Skip unknown servlet groups.
if servlet_group not in DEFAULT_SERVLET_GROUPS:
if servlet_group not in SERVLET_GROUPS:
raise RuntimeError(
f"Attempting to register unknown federation servlet: '{servlet_group}'"
)

for servletclass in DEFAULT_SERVLET_GROUPS[servlet_group]:
for servletclass in SERVLET_GROUPS[servlet_group]:
# Only allow the `/timestamp_to_event` servlet if msc3030 is enabled
if (
servletclass == FederationTimestampLookupServlet
Expand Down
3 changes: 2 additions & 1 deletion synapse/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def register_servlets(client_resource: HttpServer, hs: "HomeServer") -> None:
thirdparty.register_servlets(hs, client_resource)
sendtodevice.register_servlets(hs, client_resource)
user_directory.register_servlets(hs, client_resource)
groups.register_servlets(hs, client_resource)
if hs.config.experimental.groups_enabled:
groups.register_servlets(hs, client_resource)
room_upgrade_rest_servlet.register_servlets(hs, client_resource)
room_batch.register_servlets(hs, client_resource)
capabilities.register_servlets(hs, client_resource)
Expand Down
3 changes: 2 additions & 1 deletion synapse/rest/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ def register_servlets_for_client_rest_resource(
ResetPasswordRestServlet(hs).register(http_server)
SearchUsersRestServlet(hs).register(http_server)
UserRegisterServlet(hs).register(http_server)
DeleteGroupAdminRestServlet(hs).register(http_server)
if hs.config.experimental.groups_enabled:
DeleteGroupAdminRestServlet(hs).register(http_server)
AccountValidityRenewServlet(hs).register(http_server)

# Load the media repo ones if we're using them. Otherwise load the servlets which
Expand Down

0 comments on commit e3a3a1e

Please sign in to comment.