From b3f791ec3b7c321eabd34aeaa1d5dddc238f94ea Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 9 Feb 2023 21:26:21 +0000 Subject: 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. --- rust/benches/evaluator.rs | 1 + synapse/handlers/auth.py | 2 +- synapse/handlers/deactivate_account.py | 2 +- synapse/rest/admin/users.py | 2 +- synapse/rest/client/account.py | 2 +- tests/push/test_email.py | 6 ++---- 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" ) ) -- cgit 1.5.1