diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2022-08-19 17:17:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-19 16:17:10 +0000 |
commit | f9f03426de338ae1879e174f63adf698bbfc3a4b (patch) | |
tree | 06baecf934226ff51b1f2fe91634a5fe8b762ffa /synapse/handlers/device.py | |
parent | Register homeserver modules when creating test homeserver (#13558) (diff) | |
download | synapse-f9f03426de338ae1879e174f63adf698bbfc3a4b.tar.xz |
Implement MSC3852: Expose `last_seen_user_agent` to users for their own devices; also expose to Admin API (#13549)
Diffstat (limited to 'synapse/handlers/device.py')
-rw-r--r-- | synapse/handlers/device.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index 1a8379854c..f5c586f657 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -74,6 +74,7 @@ class DeviceWorkerHandler: self._state_storage = hs.get_storage_controllers().state self._auth_handler = hs.get_auth_handler() self.server_name = hs.hostname + self._msc3852_enabled = hs.config.experimental.msc3852_enabled @trace async def get_devices_by_user(self, user_id: str) -> List[JsonDict]: @@ -747,7 +748,13 @@ def _update_device_from_client_ips( device: JsonDict, client_ips: Mapping[Tuple[str, str], Mapping[str, Any]] ) -> None: ip = client_ips.get((device["user_id"], device["device_id"]), {}) - device.update({"last_seen_ts": ip.get("last_seen"), "last_seen_ip": ip.get("ip")}) + device.update( + { + "last_seen_user_agent": ip.get("user_agent"), + "last_seen_ts": ip.get("last_seen"), + "last_seen_ip": ip.get("ip"), + } + ) class DeviceListUpdater: |