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/handlers/device.py | |
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/handlers/device.py')
-rw-r--r-- | synapse/handlers/device.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index f3a713f5fa..b7bf70a72d 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -722,6 +722,22 @@ class DeviceHandler(DeviceWorkerHandler): return {"success": True} + async def delete_dehydrated_device(self, user_id: str, device_id: str) -> None: + """ + Delete a stored dehydrated device. + + Args: + user_id: the user_id to delete the device from + device_id: id of the dehydrated device to delete + """ + success = await self.store.remove_dehydrated_device(user_id, device_id) + + if not success: + raise errors.NotFoundError() + + await self.delete_devices(user_id, [device_id]) + await self.store.delete_e2e_keys_by_device(user_id=user_id, device_id=device_id) + @wrap_as_background_process("_handle_new_device_update_async") async def _handle_new_device_update_async(self) -> None: """Called when we have a new local device list update that we need to |