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:
@@ -14,6 +14,7 @@
|
||||
|
||||
#![feature(test)]
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use synapse::push::{
|
||||
evaluator::PushRuleEvaluator, Condition, EventMatchCondition, FilteredPushRules, PushRules,
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user