summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2023-02-09 21:26:21 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2023-02-09 21:29:59 +0000
commitb3f791ec3b7c321eabd34aeaa1d5dddc238f94ea (patch)
treebc7866ca8504c943d2a19ba486314f0f5404bb47
parentAdd support for devenv developer environments (diff)
downloadsynapse-b3f791ec3b7c321eabd34aeaa1d5dddc238f94ea.tar.xz
Rename delete_threepid -> delete_and_unbind_threepid
To make it more obvious that this method will also
attempt to unbind threepids that are deleted through it.
-rw-r--r--rust/benches/evaluator.rs1
-rw-r--r--synapse/handlers/auth.py2
-rw-r--r--synapse/handlers/deactivate_account.py2
-rw-r--r--synapse/rest/admin/users.py2
-rw-r--r--synapse/rest/client/account.py2
-rw-r--r--tests/push/test_email.py6
6 files changed, 7 insertions, 8 deletions
diff --git a/rust/benches/evaluator.rs b/rust/benches/evaluator.rs
index 35f7a50bce..8ad7ea74f1 100644
--- a/rust/benches/evaluator.rs
+++ b/rust/benches/evaluator.rs
@@ -14,6 +14,7 @@
 
 #![feature(test)]
 use std::collections::BTreeSet;
+
 use synapse::push::{
     evaluator::PushRuleEvaluator, Condition, EventMatchCondition, FilteredPushRules, PushRules,
 };
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index e6f9e5f878..8da017c3ba 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -1595,7 +1595,7 @@ class AuthHandler:
         # has successfully been created.
         await self._third_party_rules.on_threepid_bind(user_id, medium, address)
 
-    async def delete_threepid(
+    async def delete_and_unbind_threepid(
         self, user_id: str, medium: str, address: str, id_server: Optional[str] = None
     ) -> bool:
         """Attempts to unbind the 3pid on the identity servers and deletes it
diff --git a/synapse/handlers/deactivate_account.py b/synapse/handlers/deactivate_account.py
index aea0f8b7c2..a10b89ec30 100644
--- a/synapse/handlers/deactivate_account.py
+++ b/synapse/handlers/deactivate_account.py
@@ -105,7 +105,7 @@ class DeactivateAccountHandler:
         threepids = await self.store.user_get_threepids(user_id)
         for threepid in threepids:
             try:
-                result = await self._auth_handler.delete_threepid(
+                result = await self._auth_handler.delete_and_unbind_threepid(
                     user_id, threepid["medium"], threepid["address"], id_server
                 )
             except Exception:
diff --git a/synapse/rest/admin/users.py b/synapse/rest/admin/users.py
index b9dca8ef3a..9276a81d9f 100644
--- a/synapse/rest/admin/users.py
+++ b/synapse/rest/admin/users.py
@@ -304,7 +304,7 @@ class UserRestServletV2(RestServlet):
                 # remove old threepids
                 for medium, address in del_threepids:
                     try:
-                        await self.auth_handler.delete_threepid(
+                        await self.auth_handler.delete_and_unbind_threepid(
                             user_id, medium, address, None
                         )
                     except Exception:
diff --git a/synapse/rest/client/account.py b/synapse/rest/client/account.py
index 4373c73662..5b1e94c746 100644
--- a/synapse/rest/client/account.py
+++ b/synapse/rest/client/account.py
@@ -770,7 +770,7 @@ class ThreepidDeleteRestServlet(RestServlet):
         user_id = requester.user.to_string()
 
         try:
-            ret = await self.auth_handler.delete_threepid(
+            ret = await self.auth_handler.delete_and_unbind_threepid(
                 user_id, body.medium, body.address, body.id_server
             )
         except Exception:
diff --git a/tests/push/test_email.py b/tests/push/test_email.py
index ab8bb417e7..5faf66e0ff 100644
--- a/tests/push/test_email.py
+++ b/tests/push/test_email.py
@@ -367,10 +367,8 @@ class EmailPusherTests(HomeserverTestCase):
 
         # disassociate the user's email address
         self.get_success(
-            self.auth_handler.delete_threepid(
-                user_id=self.user_id,
-                medium="email",
-                address="a@example.com",
+            self.auth_handler.delete_and_unbind_threepid(
+                user_id=self.user_id, medium="email", address="a@example.com"
             )
         )