mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +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',
|
'PhabricatorUserEditEngine' => 'PhabricatorEditEngine',
|
||||||
'PhabricatorUserEditor' => 'PhabricatorEditor',
|
'PhabricatorUserEditor' => 'PhabricatorEditor',
|
||||||
'PhabricatorUserEditorTestCase' => 'PhabricatorTestCase',
|
'PhabricatorUserEditorTestCase' => 'PhabricatorTestCase',
|
||||||
'PhabricatorUserEmail' => 'PhabricatorUserDAO',
|
'PhabricatorUserEmail' => array(
|
||||||
|
'PhabricatorUserDAO',
|
||||||
|
'PhabricatorDestructibleInterface',
|
||||||
|
),
|
||||||
'PhabricatorUserEmailTestCase' => 'PhabricatorTestCase',
|
'PhabricatorUserEmailTestCase' => 'PhabricatorTestCase',
|
||||||
'PhabricatorUserEmpowerTransaction' => 'PhabricatorUserTransactionType',
|
'PhabricatorUserEmpowerTransaction' => 'PhabricatorUserTransactionType',
|
||||||
'PhabricatorUserFerretEngine' => 'PhabricatorFerretEngine',
|
'PhabricatorUserFerretEngine' => 'PhabricatorFerretEngine',
|
||||||
|
|
|
@ -241,7 +241,8 @@ final class PhabricatorUserEditor extends PhabricatorEditor {
|
||||||
throw new Exception(pht('Email not owned by user!'));
|
throw new Exception(pht('Email not owned by user!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$email->delete();
|
id(new PhabricatorDestructionEngine())
|
||||||
|
->destroyObject($email);
|
||||||
|
|
||||||
$log = PhabricatorUserLog::initializeNewLog(
|
$log = PhabricatorUserLog::initializeNewLog(
|
||||||
$actor,
|
$actor,
|
||||||
|
|
|
@ -1148,7 +1148,7 @@ final class PhabricatorUser
|
||||||
'userPHID = %s',
|
'userPHID = %s',
|
||||||
$this->getPHID());
|
$this->getPHID());
|
||||||
foreach ($emails as $email) {
|
foreach ($emails as $email) {
|
||||||
$email->delete();
|
$engine->destroyObject($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sessions = id(new PhabricatorAuthSession())->loadAllWhere(
|
$sessions = id(new PhabricatorAuthSession())->loadAllWhere(
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
* @task restrictions Domain Restrictions
|
* @task restrictions Domain Restrictions
|
||||||
* @task email Email About Email
|
* @task email Email About Email
|
||||||
*/
|
*/
|
||||||
final class PhabricatorUserEmail extends PhabricatorUserDAO {
|
final class PhabricatorUserEmail
|
||||||
|
extends PhabricatorUserDAO
|
||||||
|
implements PhabricatorDestructibleInterface {
|
||||||
|
|
||||||
protected $userPHID;
|
protected $userPHID;
|
||||||
protected $address;
|
protected $address;
|
||||||
|
@ -271,4 +273,13 @@ final class PhabricatorUserEmail extends PhabricatorUserDAO {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function destroyObjectPermanently(
|
||||||
|
PhabricatorDestructionEngine $engine) {
|
||||||
|
$this->delete();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue