mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-28 11:34:29 +00:00
Remove support for MSC3852: Expose user agent information on Device as the MSC was closed. (#19430)
Fixes: #14836 Discovered whilst looking at the state of MSCs in Synapse. --------- Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Remove support for [MSC3852: Expose user agent information on Device](https://github.com/matrix-org/matrix-spec-proposals/pull/3852) as the MSC was closed.
|
||||
@@ -445,9 +445,6 @@ class ExperimentalConfig(Config):
|
||||
# MSC3848: Introduce errcodes for specific event sending failures
|
||||
self.msc3848_enabled: bool = experimental.get("msc3848_enabled", False)
|
||||
|
||||
# MSC3852: Expose last seen user agent field on /_matrix/client/v3/devices.
|
||||
self.msc3852_enabled: bool = experimental.get("msc3852_enabled", False)
|
||||
|
||||
# MSC3866: M_USER_AWAITING_APPROVAL error code
|
||||
raw_msc3866_config = experimental.get("msc3866", {})
|
||||
self.msc3866 = MSC3866Config(**raw_msc3866_config)
|
||||
|
||||
@@ -129,7 +129,6 @@ class DeviceHandler:
|
||||
self._auth_handler = hs.get_auth_handler()
|
||||
self._account_data_handler = hs.get_account_data_handler()
|
||||
self._event_sources = hs.get_event_sources()
|
||||
self._msc3852_enabled = hs.config.experimental.msc3852_enabled
|
||||
self._query_appservices_for_keys = (
|
||||
hs.config.experimental.msc3984_appservice_key_query
|
||||
)
|
||||
|
||||
@@ -55,7 +55,6 @@ class DevicesRestServlet(RestServlet):
|
||||
self.hs = hs
|
||||
self.auth = hs.get_auth()
|
||||
self.device_handler = hs.get_device_handler()
|
||||
self._msc3852_enabled = hs.config.experimental.msc3852_enabled
|
||||
|
||||
async def on_GET(self, request: SynapseRequest) -> tuple[int, JsonDict]:
|
||||
requester = await self.auth.get_user_by_req(request, allow_guest=True)
|
||||
@@ -63,17 +62,10 @@ class DevicesRestServlet(RestServlet):
|
||||
requester.user.to_string()
|
||||
)
|
||||
|
||||
# If MSC3852 is disabled, then the "last_seen_user_agent" field will be
|
||||
# removed from each device. If it is enabled, then the field name will
|
||||
# be replaced by the unstable identifier.
|
||||
#
|
||||
# When MSC3852 is accepted, this block of code can just be removed to
|
||||
# expose "last_seen_user_agent" to clients.
|
||||
for device in devices:
|
||||
last_seen_user_agent = device["last_seen_user_agent"]
|
||||
# This field is only for admin access and should not be exposed to clients.
|
||||
# (MSC3852, which is closed, did propose to expose it.).
|
||||
del device["last_seen_user_agent"]
|
||||
if self._msc3852_enabled:
|
||||
device["org.matrix.msc3852.last_seen_user_agent"] = last_seen_user_agent
|
||||
|
||||
return 200, {"devices": devices}
|
||||
|
||||
@@ -144,7 +136,6 @@ class DeviceRestServlet(RestServlet):
|
||||
handler = hs.get_device_handler()
|
||||
self.device_handler = handler
|
||||
self.auth_handler = hs.get_auth_handler()
|
||||
self._msc3852_enabled = hs.config.experimental.msc3852_enabled
|
||||
self._auth_delegation_enabled = (
|
||||
hs.config.mas.enabled or hs.config.experimental.msc3861.enabled
|
||||
)
|
||||
@@ -159,16 +150,9 @@ class DeviceRestServlet(RestServlet):
|
||||
if device is None:
|
||||
raise NotFoundError("No device found")
|
||||
|
||||
# If MSC3852 is disabled, then the "last_seen_user_agent" field will be
|
||||
# removed from each device. If it is enabled, then the field name will
|
||||
# be replaced by the unstable identifier.
|
||||
#
|
||||
# When MSC3852 is accepted, this block of code can just be removed to
|
||||
# expose "last_seen_user_agent" to clients.
|
||||
last_seen_user_agent = device["last_seen_user_agent"]
|
||||
# This field is only for admin access and should not be exposed to clients.
|
||||
# (MSC3852, which is closed, did propose to expose it.)
|
||||
del device["last_seen_user_agent"]
|
||||
if self._msc3852_enabled:
|
||||
device["org.matrix.msc3852.last_seen_user_agent"] = last_seen_user_agent
|
||||
|
||||
return 200, device
|
||||
|
||||
|
||||
Reference in New Issue
Block a user