summary refs log tree commit diff
path: root/synapse/storage/registration.py
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2018-05-14 11:31:48 +0100
committerGitHub <noreply@github.com>2018-05-14 11:31:48 +0100
commit8cbbfd16fb1e6d685f64500f4905dfb716a9d2d9 (patch)
treed8f8053503513ce1f63040ad230033a09e820adb /synapse/storage/registration.py
parentMerge pull request #2846 from kaiyou/feat-dockerfile (diff)
parentCatch failure to part user from room (diff)
downloadsynapse-8cbbfd16fb1e6d685f64500f4905dfb716a9d2d9.tar.xz
Merge pull request #3201 from matrix-org/dbkr/leave_rooms_on_deactivate
Part user from rooms on account deactivate
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r--synapse/storage/registration.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index a50717db2d..c05ce4612f 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -526,3 +526,42 @@ class RegistrationStore(RegistrationWorkerStore,
         except self.database_engine.module.IntegrityError:
             ret = yield self.get_3pid_guest_access_token(medium, address)
             defer.returnValue(ret)
+
+    def add_user_pending_deactivation(self, user_id):
+        """
+        Adds a user to the table of users who need to be parted from all the rooms they're
+        in
+        """
+        return self._simple_insert(
+            "users_pending_deactivation",
+            values={
+                "user_id": user_id,
+            },
+            desc="add_user_pending_deactivation",
+        )
+
+    def del_user_pending_deactivation(self, user_id):
+        """
+        Removes the given user to the table of users who need to be parted from all the
+        rooms they're in, effectively marking that user as fully deactivated.
+        """
+        return self._simple_delete_one(
+            "users_pending_deactivation",
+            keyvalues={
+                "user_id": user_id,
+            },
+            desc="del_user_pending_deactivation",
+        )
+
+    def get_user_pending_deactivation(self):
+        """
+        Gets one user from the table of users waiting to be parted from all the rooms
+        they're in.
+        """
+        return self._simple_select_one_onecol(
+            "users_pending_deactivation",
+            keyvalues={},
+            retcol="user_id",
+            allow_none=True,
+            desc="get_users_pending_deactivation",
+        )