diff --git a/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php b/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php index d65c939a61..f3858afbf8 100644 --- a/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php +++ b/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php @@ -112,7 +112,7 @@ final class AuditQueryConduitAPIMethod extends AuditConduitAPIMethod { 'id' => $request->getID(), 'commitPHID' => $request->getCommitPHID(), 'auditorPHID' => $request->getAuditorPHID(), - 'reasons' => $request->getAuditReasons(), + 'reasons' => array(), 'status' => $request->getAuditStatus(), ); } diff --git a/src/applications/audit/constants/PhabricatorAuditActionConstants.php b/src/applications/audit/constants/PhabricatorAuditActionConstants.php index d323540795..aa467d41c4 100644 --- a/src/applications/audit/constants/PhabricatorAuditActionConstants.php +++ b/src/applications/audit/constants/PhabricatorAuditActionConstants.php @@ -12,36 +12,4 @@ final class PhabricatorAuditActionConstants extends Phobject { const INLINE = 'audit:inline'; const ACTION = 'audit:action'; - public static function getActionNameMap() { - $map = array( - self::COMMENT => pht('Comment'), - self::CONCERN => pht("Raise Concern \xE2\x9C\x98"), - self::ACCEPT => pht("Accept Commit \xE2\x9C\x94"), - self::RESIGN => pht('Resign from Audit'), - self::CLOSE => pht('Close Audit'), - self::ADD_CCS => pht('Add Subscribers'), - self::ADD_AUDITORS => pht('Add Auditors'), - ); - - return $map; - } - - public static function getActionName($constant) { - $map = self::getActionNameMap(); - return idx($map, $constant, pht('Unknown')); - } - - public static function getActionPastTenseVerb($action) { - $map = array( - self::COMMENT => pht('commented on'), - self::CONCERN => pht('raised a concern with'), - self::ACCEPT => pht('accepted'), - self::RESIGN => pht('resigned from'), - self::CLOSE => pht('closed'), - self::ADD_CCS => pht('added CCs to'), - self::ADD_AUDITORS => pht('added auditors to'), - ); - return idx($map, $action, pht('updated')); - } - } diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index ff1e69d8cb..1c43b08905 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -5,7 +5,6 @@ final class PhabricatorAuditEditor const MAX_FILES_SHOWN_IN_EMAIL = 1000; - private $auditReasonMap = array(); private $affectedFiles; private $rawPatch; private $auditorPHIDs = array(); @@ -13,26 +12,6 @@ final class PhabricatorAuditEditor private $didExpandInlineState = false; private $oldAuditStatus = null; - public function addAuditReason($phid, $reason) { - if (!isset($this->auditReasonMap[$phid])) { - $this->auditReasonMap[$phid] = array(); - } - $this->auditReasonMap[$phid][] = $reason; - return $this; - } - - private function getAuditReasons($phid) { - if (isset($this->auditReasonMap[$phid])) { - return $this->auditReasonMap[$phid]; - } - if ($this->getIsHeraldEditor()) { - $name = 'herald'; - } else { - $name = $this->getActor()->getUsername(); - } - return array(pht('Added by %s.', $name)); - } - public function setRawPatch($patch) { $this->rawPatch = $patch; return $this; @@ -62,7 +41,6 @@ final class PhabricatorAuditEditor // TODO: These will get modernized eventually, but that can happen one // at a time later on. $types[] = PhabricatorAuditActionConstants::INLINE; - $types[] = PhabricatorAuditActionConstants::ADD_AUDITORS; return $types; } @@ -107,10 +85,6 @@ final class PhabricatorAuditEditor case PhabricatorAuditActionConstants::INLINE: case PhabricatorAuditTransaction::TYPE_COMMIT: return null; - case PhabricatorAuditActionConstants::ADD_AUDITORS: - // TODO: For now, just record the added PHIDs. Eventually, turn these - // into real edge transactions, probably? - return array(); } return parent::getCustomTransactionOldValue($object, $xaction); @@ -122,7 +96,6 @@ final class PhabricatorAuditEditor switch ($xaction->getTransactionType()) { case PhabricatorAuditActionConstants::INLINE: - case PhabricatorAuditActionConstants::ADD_AUDITORS: case PhabricatorAuditTransaction::TYPE_COMMIT: return $xaction->getNewValue(); } @@ -136,7 +109,6 @@ final class PhabricatorAuditEditor switch ($xaction->getTransactionType()) { case PhabricatorAuditActionConstants::INLINE: - case PhabricatorAuditActionConstants::ADD_AUDITORS: case PhabricatorAuditTransaction::TYPE_COMMIT: return; } @@ -157,57 +129,6 @@ final class PhabricatorAuditEditor $reply->setHasReplies(1)->save(); } return; - case PhabricatorAuditActionConstants::ADD_AUDITORS: - $new = $xaction->getNewValue(); - if (!is_array($new)) { - $new = array(); - } - - $old = $xaction->getOldValue(); - if (!is_array($old)) { - $old = array(); - } - - $add = array_diff_key($new, $old); - - $actor = $this->requireActor(); - - $requests = $object->getAudits(); - $requests = mpull($requests, null, 'getAuditorPHID'); - foreach ($add as $phid) { - if (isset($requests[$phid])) { - $request = $requests[$phid]; - - // Only update an existing request if the current status is not - // an interesting status. - if ($request->isInteresting()) { - continue; - } - } else { - $request = id(new PhabricatorRepositoryAuditRequest()) - ->setCommitPHID($object->getPHID()) - ->setAuditorPHID($phid); - } - - if ($this->getIsHeraldEditor()) { - $audit_requested = $xaction->getMetadataValue('auditStatus'); - $audit_reason_map = $xaction->getMetadataValue('auditReasonMap'); - $audit_reason = $audit_reason_map[$phid]; - } else { - $audit_requested = PhabricatorAuditStatusConstants::AUDIT_REQUESTED; - $audit_reason = $this->getAuditReasons($phid); - } - - $request - ->setAuditStatus($audit_requested) - ->setAuditReasons($audit_reason) - ->save(); - - $requests[$phid] = $request; - } - - $object->attachAudits($requests); - return; } return parent::applyCustomExternalTransaction($object, $xaction); @@ -389,7 +310,7 @@ final class PhabricatorAuditEditor return array(); } - return id(new PhabricatorAuditTransaction()) + return $commit->getApplicationTransactionTemplate() ->setTransactionType(DiffusionCommitAuditorsTransaction::TRANSACTIONTYPE) ->setNewValue( array( diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index f88c463633..f8847b7e3b 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -855,12 +855,6 @@ final class DiffusionCommitController extends DiffusionController { PhabricatorAuditStatusConstants::getStatusColor($code), PhabricatorAuditStatusConstants::getStatusName($code)); - $note = array(); - foreach ($request->getAuditReasons() as $reason) { - $note[] = phutil_tag('div', array(), $reason); - } - $item->setNote($note); - $auditor_phid = $request->getAuditorPHID(); $target = $viewer->renderHandle($auditor_phid); $item->setTarget($target); diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php index c07adbad5e..40fb5a64f6 100644 --- a/src/applications/diffusion/query/DiffusionCommitQuery.php +++ b/src/applications/diffusion/query/DiffusionCommitQuery.php @@ -135,14 +135,6 @@ final class DiffusionCommitQuery return $this; } - public function withAuditStatus($status) { - // TODO: Replace callers with `withStatuses()`. - return $this->withStatuses( - array( - $status, - )); - } - public function withEpochRange($min, $max) { $this->epochMin = $min; $this->epochMax = $max;