1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +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:
epriestley 2019-11-14 10:20:01 -08:00
parent 18da346972
commit d69a7360ea
4 changed files with 19 additions and 4 deletions

View file

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

View file

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

View file

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

View file

@ -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();
}
}