mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
Use DestructionEngine to destroy UserEmail objects
Summary: Ref T13444. Prepare to hook identity updates when user email addreses are destroyed. Test Plan: - Destroyed a user with `bin/remove destroy ... --trace`, saw email deleted. - Destroyed an email from the web UI, saw email deleted. Maniphest Tasks: T13444 Differential Revision: https://secure.phabricator.com/D20912
This commit is contained in:
parent
18da346972
commit
d69a7360ea
4 changed files with 19 additions and 4 deletions
|
@ -11681,7 +11681,10 @@ phutil_register_library_map(array(
|
|||
'PhabricatorUserEditEngine' => 'PhabricatorEditEngine',
|
||||
'PhabricatorUserEditor' => 'PhabricatorEditor',
|
||||
'PhabricatorUserEditorTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorUserEmail' => 'PhabricatorUserDAO',
|
||||
'PhabricatorUserEmail' => array(
|
||||
'PhabricatorUserDAO',
|
||||
'PhabricatorDestructibleInterface',
|
||||
),
|
||||
'PhabricatorUserEmailTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorUserEmpowerTransaction' => 'PhabricatorUserTransactionType',
|
||||
'PhabricatorUserFerretEngine' => 'PhabricatorFerretEngine',
|
||||
|
|
|
@ -241,7 +241,8 @@ final class PhabricatorUserEditor extends PhabricatorEditor {
|
|||
throw new Exception(pht('Email not owned by user!'));
|
||||
}
|
||||
|
||||
$email->delete();
|
||||
id(new PhabricatorDestructionEngine())
|
||||
->destroyObject($email);
|
||||
|
||||
$log = PhabricatorUserLog::initializeNewLog(
|
||||
$actor,
|
||||
|
|
|
@ -1148,7 +1148,7 @@ final class PhabricatorUser
|
|||
'userPHID = %s',
|
||||
$this->getPHID());
|
||||
foreach ($emails as $email) {
|
||||
$email->delete();
|
||||
$engine->destroyObject($email);
|
||||
}
|
||||
|
||||
$sessions = id(new PhabricatorAuthSession())->loadAllWhere(
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
* @task restrictions Domain Restrictions
|
||||
* @task email Email About Email
|
||||
*/
|
||||
final class PhabricatorUserEmail extends PhabricatorUserDAO {
|
||||
final class PhabricatorUserEmail
|
||||
extends PhabricatorUserDAO
|
||||
implements PhabricatorDestructibleInterface {
|
||||
|
||||
protected $userPHID;
|
||||
protected $address;
|
||||
|
@ -271,4 +273,13 @@ final class PhabricatorUserEmail extends PhabricatorUserDAO {
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
$this->delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue