diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -11681,7 +11681,10 @@ 'PhabricatorUserEditEngine' => 'PhabricatorEditEngine', 'PhabricatorUserEditor' => 'PhabricatorEditor', 'PhabricatorUserEditorTestCase' => 'PhabricatorTestCase', - 'PhabricatorUserEmail' => 'PhabricatorUserDAO', + 'PhabricatorUserEmail' => array( + 'PhabricatorUserDAO', + 'PhabricatorDestructibleInterface', + ), 'PhabricatorUserEmailTestCase' => 'PhabricatorTestCase', 'PhabricatorUserEmpowerTransaction' => 'PhabricatorUserTransactionType', 'PhabricatorUserFerretEngine' => 'PhabricatorFerretEngine', diff --git a/src/applications/people/editor/PhabricatorUserEditor.php b/src/applications/people/editor/PhabricatorUserEditor.php --- a/src/applications/people/editor/PhabricatorUserEditor.php +++ b/src/applications/people/editor/PhabricatorUserEditor.php @@ -241,7 +241,8 @@ throw new Exception(pht('Email not owned by user!')); } - $email->delete(); + id(new PhabricatorDestructionEngine()) + ->destroyObject($email); $log = PhabricatorUserLog::initializeNewLog( $actor, diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -1148,7 +1148,7 @@ 'userPHID = %s', $this->getPHID()); foreach ($emails as $email) { - $email->delete(); + $engine->destroyObject($email); } $sessions = id(new PhabricatorAuthSession())->loadAllWhere( diff --git a/src/applications/people/storage/PhabricatorUserEmail.php b/src/applications/people/storage/PhabricatorUserEmail.php --- a/src/applications/people/storage/PhabricatorUserEmail.php +++ b/src/applications/people/storage/PhabricatorUserEmail.php @@ -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 @@ return $this; } + +/* -( PhabricatorDestructibleInterface )----------------------------------- */ + + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + $this->delete(); + } + }