diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 9d85964435..ffb824f177 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/applications/people/editor/PhabricatorUserEditor.php b/src/applications/people/editor/PhabricatorUserEditor.php index 81f427ada8..34bc1ae03f 100644 --- a/src/applications/people/editor/PhabricatorUserEditor.php +++ b/src/applications/people/editor/PhabricatorUserEditor.php @@ -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, diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index cce4ffa58a..a62aab4fc3 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -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( diff --git a/src/applications/people/storage/PhabricatorUserEmail.php b/src/applications/people/storage/PhabricatorUserEmail.php index 572c7d6e8b..f626e8f133 100644 --- 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 @@ final class PhabricatorUserEmail extends PhabricatorUserDAO { return $this; } + +/* -( PhabricatorDestructibleInterface )----------------------------------- */ + + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + $this->delete(); + } + }