Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/19430.removal
Original file line number Diff line number Diff line change
@@ -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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint is still in use by the current implementation of the Device Manager in Element clients, so I feel we should support it for a little bit longer until that implementation is rewritten to no longer use this endpoint, and some time further after that still. But we should eventually remove it.

No wider deprecation period is necessary as this is an experimental feature. But it would be nice to coordinate with the Element devs before doing so as not to pull the rug out from under them.

-- #14836

Feels like this doesn't matter as it's been 3+ years since that was written but just for completeness sake, were Element clients transitioned away already?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears they still reference MSC3852 in the code https://github.com/search?q=repo%3Aelement-hq%2Felement-web%20MSC3852&type=code

However, they must also function without it, as other homeserver implementations won't provide this endpoint. So it's not a blocker for us removing support for a rejected MSC.

3 changes: 0 additions & 3 deletions synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,6 @@ def read_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)
Expand Down
1 change: 0 additions & 1 deletion synapse/handlers/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def __init__(self, hs: "HomeServer"):
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
)
Expand Down
24 changes: 4 additions & 20 deletions synapse/rest/client/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,17 @@ def __init__(self, hs: "HomeServer"):
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)
devices = await self.device_handler.get_devices_by_user(
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}

Expand Down Expand Up @@ -144,7 +136,6 @@ def __init__(self, hs: "HomeServer"):
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
)
Expand All @@ -159,16 +150,9 @@ async def on_GET(
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

Expand Down
Loading