diff --git a/src/applications/diffusion/xaction/DiffusionCommitAuditTransaction.php b/src/applications/diffusion/xaction/DiffusionCommitAuditTransaction.php index 64d32d1700..86656d85a6 100644 --- a/src/applications/diffusion/xaction/DiffusionCommitAuditTransaction.php +++ b/src/applications/diffusion/xaction/DiffusionCommitAuditTransaction.php @@ -13,6 +13,23 @@ abstract class DiffusionCommitAuditTransaction return ($this->getViewerAuditStatus($commit, $viewer) !== null); } + protected function isViewerAnyActiveAuditor( + PhabricatorRepositoryCommit $commit, + PhabricatorUser $viewer) { + + // This omits various inactive states like "Resigned" and "Not Required". + + return $this->isViewerAuditStatusAmong( + $commit, + $viewer, + array( + PhabricatorAuditStatusConstants::AUDIT_REQUIRED, + PhabricatorAuditStatusConstants::CONCERNED, + PhabricatorAuditStatusConstants::ACCEPTED, + PhabricatorAuditStatusConstants::AUDIT_REQUESTED, + )); + } + protected function isViewerAcceptingAuditor( PhabricatorRepositoryCommit $commit, PhabricatorUser $viewer) { diff --git a/src/applications/diffusion/xaction/DiffusionCommitResignTransaction.php b/src/applications/diffusion/xaction/DiffusionCommitResignTransaction.php index 1a553e3471..4a68252414 100644 --- a/src/applications/diffusion/xaction/DiffusionCommitResignTransaction.php +++ b/src/applications/diffusion/xaction/DiffusionCommitResignTransaction.php @@ -28,7 +28,7 @@ final class DiffusionCommitResignTransaction public function generateOldValue($object) { $actor = $this->getActor(); - return !$this->isViewerAnyAuditor($object, $actor); + return !$this->isViewerAnyActiveAuditor($object, $actor); } public function applyExternalEffects($object, $value) { @@ -38,11 +38,11 @@ final class DiffusionCommitResignTransaction } protected function validateAction($object, PhabricatorUser $viewer) { - if (!$this->isViewerAnyAuditor($object, $viewer)) { + if (!$this->isViewerAnyActiveAuditor($object, $viewer)) { throw new Exception( pht( 'You can not resign from this commit because you are not an '. - 'auditor.')); + 'active auditor.')); } }