summary refs log tree commit diff
path: root/synapse/storage/devices.py
diff options
context:
space:
mode:
authorLuke Barnard <lukebarnard1@users.noreply.github.com>2017-03-14 10:02:56 +0000
committerGitHub <noreply@github.com>2017-03-14 10:02:56 +0000
commitf29d85d9e4e0e19ada3b1187439287adc82cfa74 (patch)
tree856c056128030040e3206873ef08a6f947698012 /synapse/storage/devices.py
parentMerge pull request #1990 from matrix-org/rav/log_config_comments (diff)
parentImplement _simple_delete_many_txn, use it to delete devices (diff)
downloadsynapse-f29d85d9e4e0e19ada3b1187439287adc82cfa74.tar.xz
Merge pull request #1993 from matrix-org/luke/delete-devices
Implement delete_devices API
Diffstat (limited to 'synapse/storage/devices.py')
-rw-r--r--synapse/storage/devices.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/storage/devices.py b/synapse/storage/devices.py
index bd56ba2515..563071b7a9 100644
--- a/synapse/storage/devices.py
+++ b/synapse/storage/devices.py
@@ -108,6 +108,23 @@ class DeviceStore(SQLBaseStore):
             desc="delete_device",
         )
 
+    def delete_devices(self, user_id, device_ids):
+        """Deletes several devices.
+
+        Args:
+            user_id (str): The ID of the user which owns the devices
+            device_ids (list): The IDs of the devices to delete
+        Returns:
+            defer.Deferred
+        """
+        return self._simple_delete_many(
+            table="devices",
+            column="device_id",
+            iterable=device_ids,
+            keyvalues={"user_id": user_id},
+            desc="delete_devices",
+        )
+
     def update_device(self, user_id, device_id, new_display_name=None):
         """Update a device.