Page MenuHomePhabricator

D17187.id41332.diff
No OneTemporary

D17187.id41332.diff

diff --git a/src/applications/diffusion/xaction/DiffusionCommitAuditTransaction.php b/src/applications/diffusion/xaction/DiffusionCommitAuditTransaction.php
--- a/src/applications/diffusion/xaction/DiffusionCommitAuditTransaction.php
+++ b/src/applications/diffusion/xaction/DiffusionCommitAuditTransaction.php
@@ -13,6 +13,23 @@
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
--- a/src/applications/diffusion/xaction/DiffusionCommitResignTransaction.php
+++ b/src/applications/diffusion/xaction/DiffusionCommitResignTransaction.php
@@ -28,7 +28,7 @@
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 @@
}
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.'));
}
}

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 22, 3:59 PM (24 m, 18 s)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7033065
Default Alt Text
D17187.id41332.diff (2 KB)

Event Timeline