@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Prevent users from resigning from audits they've already resigned from

Summary: Ref T10978. Since "Resigned" is a status in Audit, you could repeatedly resign. This is confusing; prevent it.

Test Plan: Tried to resign twice; was only allowed to resign once.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10978

Differential Revision: https://secure.phabricator.com/D17187

+20 -3
+17
src/applications/diffusion/xaction/DiffusionCommitAuditTransaction.php
··· 13 13 return ($this->getViewerAuditStatus($commit, $viewer) !== null); 14 14 } 15 15 16 + protected function isViewerAnyActiveAuditor( 17 + PhabricatorRepositoryCommit $commit, 18 + PhabricatorUser $viewer) { 19 + 20 + // This omits various inactive states like "Resigned" and "Not Required". 21 + 22 + return $this->isViewerAuditStatusAmong( 23 + $commit, 24 + $viewer, 25 + array( 26 + PhabricatorAuditStatusConstants::AUDIT_REQUIRED, 27 + PhabricatorAuditStatusConstants::CONCERNED, 28 + PhabricatorAuditStatusConstants::ACCEPTED, 29 + PhabricatorAuditStatusConstants::AUDIT_REQUESTED, 30 + )); 31 + } 32 + 16 33 protected function isViewerAcceptingAuditor( 17 34 PhabricatorRepositoryCommit $commit, 18 35 PhabricatorUser $viewer) {
+3 -3
src/applications/diffusion/xaction/DiffusionCommitResignTransaction.php
··· 28 28 29 29 public function generateOldValue($object) { 30 30 $actor = $this->getActor(); 31 - return !$this->isViewerAnyAuditor($object, $actor); 31 + return !$this->isViewerAnyActiveAuditor($object, $actor); 32 32 } 33 33 34 34 public function applyExternalEffects($object, $value) { ··· 38 38 } 39 39 40 40 protected function validateAction($object, PhabricatorUser $viewer) { 41 - if (!$this->isViewerAnyAuditor($object, $viewer)) { 41 + if (!$this->isViewerAnyActiveAuditor($object, $viewer)) { 42 42 throw new Exception( 43 43 pht( 44 44 'You can not resign from this commit because you are not an '. 45 - 'auditor.')); 45 + 'active auditor.')); 46 46 } 47 47 } 48 48