diff options
author | Erik Johnston <erik@matrix.org> | 2017-03-14 11:35:05 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-03-14 11:35:05 +0000 |
commit | bb256ac96f2a10b60708d5273bee5df2533f10b8 (patch) | |
tree | ae6d19a234b566ff4fc58ec1d7b47c9622843b2c /synapse/handlers/device.py | |
parent | Add new storage function to slave store (diff) | |
parent | Merge pull request #1996 from matrix-org/erikj/fix_current_state (diff) | |
download | synapse-bb256ac96f2a10b60708d5273bee5df2533f10b8.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/public_list_speed
Diffstat (limited to 'synapse/handlers/device.py')
-rw-r--r-- | synapse/handlers/device.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index 9374c085db..1b007d4945 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -170,6 +170,40 @@ class DeviceHandler(BaseHandler): yield self.notify_device_update(user_id, [device_id]) @defer.inlineCallbacks + def delete_devices(self, user_id, device_ids): + """ Delete several devices + + Args: + user_id (str): + device_ids (str): The list of device IDs to delete + + Returns: + defer.Deferred: + """ + + try: + yield self.store.delete_devices(user_id, device_ids) + except errors.StoreError, e: + if e.code == 404: + # no match + pass + else: + raise + + # Delete access tokens and e2e keys for each device. Not optimised as it is not + # considered as part of a critical path. + for device_id in device_ids: + yield self.store.user_delete_access_tokens( + user_id, device_id=device_id, + delete_refresh_tokens=True, + ) + yield self.store.delete_e2e_keys_by_device( + user_id=user_id, device_id=device_id + ) + + yield self.notify_device_update(user_id, device_ids) + + @defer.inlineCallbacks def update_device(self, user_id, device_id, content): """ Update the given device |