Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/editor/PhabricatorUserEditor.php
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | $user->openTransaction(); | ||||
} | } | ||||
$user->saveTransaction(); | $user->saveTransaction(); | ||||
if ($email->getIsVerified()) { | if ($email->getIsVerified()) { | ||||
$this->didVerifyEmail($user, $email); | $this->didVerifyEmail($user, $email); | ||||
} | } | ||||
id(new DiffusionRepositoryIdentityEngine()) | |||||
->didUpdateEmailAddress($email->getAddress()); | |||||
return $this; | return $this; | ||||
} | } | ||||
/* -( Editing Roles )------------------------------------------------------ */ | /* -( Editing Roles )------------------------------------------------------ */ | ||||
/** | /** | ||||
* @task role | * @task role | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | $user->openTransaction(); | ||||
$user->getPHID(), | $user->getPHID(), | ||||
PhabricatorAddEmailUserLogType::LOGTYPE); | PhabricatorAddEmailUserLogType::LOGTYPE); | ||||
$log->setNewValue($email->getAddress()); | $log->setNewValue($email->getAddress()); | ||||
$log->save(); | $log->save(); | ||||
$user->endWriteLocking(); | $user->endWriteLocking(); | ||||
$user->saveTransaction(); | $user->saveTransaction(); | ||||
// Try and match this new address against unclaimed `RepositoryIdentity`s | id(new DiffusionRepositoryIdentityEngine()) | ||||
PhabricatorWorker::scheduleTask( | ->didUpdateEmailAddress($email->getAddress()); | ||||
'PhabricatorRepositoryIdentityChangeWorker', | |||||
array('userPHID' => $user->getPHID()), | |||||
array('objectPHID' => $user->getPHID())); | |||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* @task email | * @task email | ||||
*/ | */ | ||||
Show All 18 Lines | $user->openTransaction(); | ||||
if ($email->getIsPrimary()) { | if ($email->getIsPrimary()) { | ||||
throw new Exception(pht("Can't remove primary email!")); | throw new Exception(pht("Can't remove primary email!")); | ||||
} | } | ||||
if ($email->getUserPHID() != $user->getPHID()) { | if ($email->getUserPHID() != $user->getPHID()) { | ||||
throw new Exception(pht('Email not owned by user!')); | throw new Exception(pht('Email not owned by user!')); | ||||
} | } | ||||
id(new PhabricatorDestructionEngine()) | $destruction_engine = id(new PhabricatorDestructionEngine()) | ||||
->setWaitToFinalizeDestruction(true) | |||||
->destroyObject($email); | ->destroyObject($email); | ||||
$log = PhabricatorUserLog::initializeNewLog( | $log = PhabricatorUserLog::initializeNewLog( | ||||
$actor, | $actor, | ||||
$user->getPHID(), | $user->getPHID(), | ||||
PhabricatorRemoveEmailUserLogType::LOGTYPE); | PhabricatorRemoveEmailUserLogType::LOGTYPE); | ||||
$log->setOldValue($email->getAddress()); | $log->setOldValue($email->getAddress()); | ||||
$log->save(); | $log->save(); | ||||
$user->endWriteLocking(); | $user->endWriteLocking(); | ||||
$user->saveTransaction(); | $user->saveTransaction(); | ||||
$this->revokePasswordResetLinks($user); | $this->revokePasswordResetLinks($user); | ||||
$destruction_engine->finalizeDestruction(); | |||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* @task email | * @task email | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | $user->openTransaction(); | ||||
$user->endWriteLocking(); | $user->endWriteLocking(); | ||||
$user->saveTransaction(); | $user->saveTransaction(); | ||||
if ($old_primary) { | if ($old_primary) { | ||||
$old_primary->sendOldPrimaryEmail($user, $email); | $old_primary->sendOldPrimaryEmail($user, $email); | ||||
} | } | ||||
$email->sendNewPrimaryEmail($user); | $email->sendNewPrimaryEmail($user); | ||||
$this->revokePasswordResetLinks($user); | $this->revokePasswordResetLinks($user); | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* Verify a user's email address. | * Verify a user's email address. | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | $user->openTransaction(); | ||||
$user->getPHID(), | $user->getPHID(), | ||||
PhabricatorReassignEmailUserLogType::LOGTYPE); | PhabricatorReassignEmailUserLogType::LOGTYPE); | ||||
$log->setNewValue($email->getAddress()); | $log->setNewValue($email->getAddress()); | ||||
$log->save(); | $log->save(); | ||||
} | } | ||||
$user->endWriteLocking(); | $user->endWriteLocking(); | ||||
$user->saveTransaction(); | $user->saveTransaction(); | ||||
id(new DiffusionRepositoryIdentityEngine()) | |||||
->didUpdateEmailAddress($email->getAddress()); | |||||
} | } | ||||
/* -( Internals )---------------------------------------------------------- */ | /* -( Internals )---------------------------------------------------------- */ | ||||
/** | /** | ||||
* @task internal | * @task internal | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |