diff options
author | Shay <hillerys@element.io> | 2023-08-04 10:49:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 10:49:54 -0700 |
commit | 84ae2e3f6fb86115df767bb2f1fb16ac2fbaa7c3 (patch) | |
tree | 2d74b23a2b18a92dfb79e2cf1d7c47c3b6fb2853 /synapse/rest | |
parent | Stabilize support for MSC3970: updated transaction semantics (scope to `devic... (diff) | |
download | synapse-84ae2e3f6fb86115df767bb2f1fb16ac2fbaa7c3.tar.xz |
Fix deletion for Dehydrated Devices (#16046)
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/client/devices.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/rest/client/devices.py b/synapse/rest/client/devices.py index 690d2ec406..dd3f7fd666 100644 --- a/synapse/rest/client/devices.py +++ b/synapse/rest/client/devices.py @@ -513,10 +513,8 @@ class DehydratedDeviceV2Servlet(RestServlet): if dehydrated_device is not None: (device_id, device_data) = dehydrated_device - result = await self.device_handler.rehydrate_device( - requester.user.to_string(), - self.auth.get_access_token_from_request(request), - device_id, + await self.device_handler.delete_dehydrated_device( + requester.user.to_string(), device_id ) result = {"device_id": device_id} @@ -538,6 +536,14 @@ class DehydratedDeviceV2Servlet(RestServlet): requester = await self.auth.get_user_by_req(request) user_id = requester.user.to_string() + old_dehydrated_device = await self.device_handler.get_dehydrated_device(user_id) + + # if an old device exists, delete it before creating a new one + if old_dehydrated_device: + await self.device_handler.delete_dehydrated_device( + user_id, old_dehydrated_device[0] + ) + device_info = submission.dict() if "device_keys" not in device_info.keys(): raise SynapseError( |