diff options
author | Eric Eastwood <erice@element.io> | 2022-04-20 19:13:32 -0500 |
---|---|---|
committer | Eric Eastwood <erice@element.io> | 2022-04-20 19:13:32 -0500 |
commit | 7ef28b756fc0d1930b75751ad24d731a9903bd5b (patch) | |
tree | 0549991b54a9a2fe2fabb4a2f3947c42be21dcdb /synapse | |
parent | Clarify that we mark as outliers because we don't have any state for them (#1... (diff) | |
download | synapse-7ef28b756fc0d1930b75751ad24d731a9903bd5b.tar.xz |
Add MSC2716 to room capabilities
Spawned from https://github.com/matrix-org/matrix-js-sdk/pull/2299#discussion_r852893524
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/api/room_versions.py | 25 | ||||
-rw-r--r-- | synapse/rest/client/capabilities.py | 12 |
2 files changed, 36 insertions, 1 deletions
diff --git a/synapse/api/room_versions.py b/synapse/api/room_versions.py index a747a40814..12f00d0a18 100644 --- a/synapse/api/room_versions.py +++ b/synapse/api/room_versions.py @@ -313,3 +313,28 @@ MSC3244_CAPABILITIES = { ), ) } + +MSC2716_CAPABILITIES = { + cap.identifier: { + "preferred": cap.preferred_version.identifier + if cap.preferred_version is not None + else None, + "support": [ + v.identifier + for v in KNOWN_ROOM_VERSIONS.values() + if cap.support_check_lambda(v) + ], + } + for cap in ( + RoomVersionCapability( + "historical", + RoomVersions.MSC2716v3, + lambda room_version: room_version.msc2716_historical, + ), + RoomVersionCapability( + "redactions", + RoomVersions.MSC2716v3, + lambda room_version: room_version.msc2716_redactions, + ), + ) +} diff --git a/synapse/rest/client/capabilities.py b/synapse/rest/client/capabilities.py index 4237071c61..526335a172 100644 --- a/synapse/rest/client/capabilities.py +++ b/synapse/rest/client/capabilities.py @@ -15,7 +15,11 @@ import logging from http import HTTPStatus from typing import TYPE_CHECKING, Tuple -from synapse.api.room_versions import KNOWN_ROOM_VERSIONS, MSC3244_CAPABILITIES +from synapse.api.room_versions import ( + KNOWN_ROOM_VERSIONS, + MSC3244_CAPABILITIES, + MSC2716_CAPABILITIES, +) from synapse.http.server import HttpServer from synapse.http.servlet import RestServlet from synapse.http.site import SynapseRequest @@ -72,6 +76,12 @@ class CapabilitiesRestServlet(RestServlet): "org.matrix.msc3244.room_capabilities" ] = MSC3244_CAPABILITIES + logger.info("ewffewaafewafew") + if self.config.experimental.msc2716_enabled: + response["capabilities"]["m.room_versions"][ + "org.matrix.msc2716.room_capabilities" + ] = MSC2716_CAPABILITIES + if self.config.experimental.msc3720_enabled: response["capabilities"]["org.matrix.msc3720.account_status"] = { "enabled": True, |