diff --git a/conf/default.conf.php b/conf/default.conf.php index 389f1e5a3d..a335106758 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -1019,6 +1019,13 @@ return array( // use of all of differential's features. 'differential.allow-self-accept' => false, + // If you set this to true, any user can close any revision so long as it has + // been accepted. This can be useful depending on your development model. For + // example, github-style pull requests where the reviewer is often the + // actual committer can benefit from turning this option to true. If false, + // only the submitter can close a revision. + 'differential.always-allow-close' => false, + // Revisions newer than this number of days are marked as fresh in Action // Required and Revisions Waiting on You views. Only work days (not weekends // and holidays) are included. Set to 0 to disable this feature. diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 9d2dfebfd9..5d243d0599 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -565,7 +565,9 @@ final class DifferentialRevisionViewController extends DifferentialController { $status = $revision->getStatus(); $allow_self_accept = PhabricatorEnv::getEnvConfig( - 'differential.allow-self-accept', false); + 'differential.allow-self-accept', false); + $always_allow_close = PhabricatorEnv::getEnvConfig( + 'differential.always-allow-close', false); if ($viewer_is_owner) { switch ($status) { @@ -613,6 +615,7 @@ final class DifferentialRevisionViewController extends DifferentialController { } if ($status != ArcanistDifferentialRevisionStatus::CLOSED) { $actions[DifferentialAction::ACTION_CLAIM] = true; + $actions[DifferentialAction::ACTION_CLOSE] = $always_allow_close; } } diff --git a/src/applications/differential/editor/DifferentialCommentEditor.php b/src/applications/differential/editor/DifferentialCommentEditor.php index 0afd9c5a05..82817cd730 100644 --- a/src/applications/differential/editor/DifferentialCommentEditor.php +++ b/src/applications/differential/editor/DifferentialCommentEditor.php @@ -118,7 +118,9 @@ final class DifferentialCommentEditor { $actor = id(new PhabricatorUser())->loadOneWhere('PHID = %s', $actor_phid); $actor_is_author = ($actor_phid == $revision->getAuthorPHID()); $allow_self_accept = PhabricatorEnv::getEnvConfig( - 'differential.allow-self-accept', false); + 'differential.allow-self-accept', false); + $always_allow_close = PhabricatorEnv::getEnvConfig( + 'differential.always-allow-close', false); $revision_status = $revision->getStatus(); $revision->loadRelationships(); @@ -349,7 +351,7 @@ final class DifferentialCommentEditor { // them as completely authoritative. if (!$this->isDaemonWorkflow) { - if (!$actor_is_author) { + if (!$actor_is_author && !$always_allow_close) { throw new Exception( "You can not mark a revision you don't own as closed."); }