Changeset View
Changeset View
Standalone View
Standalone View
src/applications/audit/editor/PhabricatorAuditCommentEditor.php
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | foreach ($comments as $comment) { | ||||
case PhabricatorAuditActionConstants::ACCEPT: | case PhabricatorAuditActionConstants::ACCEPT: | ||||
case PhabricatorAuditActionConstants::CONCERN: | case PhabricatorAuditActionConstants::CONCERN: | ||||
$action = $comment->getAction(); | $action = $comment->getAction(); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if ($action == PhabricatorAuditActionConstants::CLOSE) { | if ($action == PhabricatorAuditActionConstants::CLOSE) { | ||||
if (!PhabricatorEnv::getEnvConfig('audit.can-author-close-audit')) { | |||||
throw new Exception('Cannot Close Audit without enabling'. | // This is now applied by the transaction Editor. | ||||
'audit.can-author-close-audit'); | |||||
} | |||||
// "Close" means wipe out all the concerns. | |||||
$concerned_status = PhabricatorAuditStatusConstants::CONCERNED; | |||||
foreach ($requests as $request) { | |||||
if ($request->getAuditStatus() == $concerned_status) { | |||||
$request->setAuditStatus(PhabricatorAuditStatusConstants::CLOSED); | |||||
$request->save(); | |||||
} | |||||
} | |||||
} else if ($action == PhabricatorAuditActionConstants::RESIGN) { | } else if ($action == PhabricatorAuditActionConstants::RESIGN) { | ||||
// "Resign" has unusual rules for writing user rows, only affects the | |||||
// user row (never package/project rows), and always affects the user | |||||
// row (other actions don't, if they were able to affect a package/project | |||||
// row). | |||||
$actor_request = null; | |||||
foreach ($requests as $request) { | |||||
if ($request->getAuditorPHID() == $actor->getPHID()) { | |||||
$actor_request = $request; | |||||
break; | |||||
} | |||||
} | |||||
if (!$actor_request) { | |||||
$actor_request = id(new PhabricatorRepositoryAuditRequest()) | |||||
->setCommitPHID($commit->getPHID()) | |||||
->setAuditorPHID($actor->getPHID()) | |||||
->setAuditReasons(array('Resigned')); | |||||
} | |||||
$actor_request | // This is now applied by the transaction Editor. | ||||
->setAuditStatus(PhabricatorAuditStatusConstants::RESIGNED) | |||||
->save(); | |||||
$requests[] = $actor_request; | |||||
} else { | } else { | ||||
$have_any_requests = false; | $have_any_requests = false; | ||||
foreach ($requests as $request) { | foreach ($requests as $request) { | ||||
if (empty($audit_phids[$request->getAuditorPHID()])) { | if (empty($audit_phids[$request->getAuditorPHID()])) { | ||||
continue; | continue; | ||||
} | } | ||||
$request_is_for_actor = | $request_is_for_actor = | ||||
▲ Show 20 Lines • Show All 154 Lines • Show Last 20 Lines |