diff --git a/src/applications/diffusion/herald/DiffusionAuditorsHeraldAction.php b/src/applications/diffusion/herald/DiffusionAuditorsHeraldAction.php --- a/src/applications/diffusion/herald/DiffusionAuditorsHeraldAction.php +++ b/src/applications/diffusion/herald/DiffusionAuditorsHeraldAction.php @@ -3,6 +3,7 @@ abstract class DiffusionAuditorsHeraldAction extends HeraldAction { + const DO_AUTHORS = 'do.authors'; const DO_ADD_AUDITORS = 'do.add-auditors'; public function getActionGroupKey() { @@ -19,6 +20,22 @@ $auditors = $object->getAudits(); + // Don't try to add commit authors as auditors. + $authors = array(); + foreach ($phids as $key => $phid) { + if ($phid == $object->getAuthorPHID()) { + $authors[] = $phid; + unset($phids[$key]); + } + } + + if ($authors) { + $this->logEffect(self::DO_AUTHORS, $authors); + if (!$phids) { + return; + } + } + $current = array(); foreach ($auditors as $auditor) { if ($auditor->isInteresting()) { @@ -53,6 +70,11 @@ protected function getActionEffectMap() { return array( + self::DO_AUTHORS => array( + 'icon' => 'fa-user', + 'color' => 'grey', + 'name' => pht('Commit Author'), + ), self::DO_ADD_AUDITORS => array( 'icon' => 'fa-user', 'color' => 'green', @@ -63,6 +85,10 @@ protected function renderActionEffectDescription($type, $data) { switch ($type) { + case self::DO_AUTHORS: + return pht( + 'Declined to add commit author as auditor: %s.', + $this->renderHandleList($data)); case self::DO_ADD_AUDITORS: return pht( 'Added %s auditor(s): %s.',