Commit b941331b authored by epriestley's avatar epriestley
Browse files

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:
parent 11861265
......@@ -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(
protected function isViewerAcceptingAuditor(
PhabricatorRepositoryCommit $commit,
PhabricatorUser $viewer) {
......@@ -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(
'You can not resign from this commit because you are not an '.
'active auditor.'));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment