1
0

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.
This commit is contained in:
Andrew Morgan
2023-02-09 21:26:21 +00:00
parent 0ddd44ff5f
commit b3f791ec3b
6 changed files with 7 additions and 8 deletions

View File

@@ -14,6 +14,7 @@
#![feature(test)]
use std::collections::BTreeSet;
use synapse::push::{
evaluator::PushRuleEvaluator, Condition, EventMatchCondition, FilteredPushRules, PushRules,
};

View File

@@ -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

View File

@@ -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:

View File

@@ -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:

View File

@@ -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:

View File

@@ -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"
)
)