From b435c03ecaf39851fc60a4bc3eff7fd3ea8fe0d0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 25 Nov 2013 17:40:01 -0800 Subject: [PATCH] Add a config flag to treat "Accepted" revisions as "Closed" Summary: See D7653. This is exclusively for Asana, who uses Differential for a post-commit, Audit-like workflow but has a small set of requirements for it to be a good fit (just this) and a large set of requirements for Diffusion/Audit to be a good fit. Test Plan: Set the flag, verified "Accepted" revisions are no longer on the dashboard. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7654 --- .../PhabricatorDifferentialConfigOptions.php | 20 +++++++++++++++++++ .../constants/DifferentialRevisionStatus.php | 8 +++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 0066d40271..907f9a3fe6 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -146,6 +146,26 @@ final class PhabricatorDifferentialConfigOptions "is accidentally closed or if a developer changes his or her ". "mind after closing a revision. If it is false, reopening ". "is not allowed.")), + $this->newOption('differential.close-on-accept', 'bool', false) + ->setBoolOptions( + array( + pht('Treat Accepted Revisions as "Closed"'), + pht('Treat Accepted Revisions as "Open"'), + )) + ->setSummary(pht('Allows "Accepted" to act as a closed status.')) + ->setDescription( + pht( + 'Normally, Differential revisions remain on the dashboard when '. + 'they are "Accepted", and the author then commits the changes '. + 'to "Close" the revision and move it off the dashboard.'. + "\n\n". + 'If you have an unusual workflow where Differential is used for '. + 'post-commit review (normally called "Audit", elsewhere in '. + 'Phabricator), you can set this flag to treat the "Accepted" '. + 'state as a "Closed" state and end the review workflow early.'. + "\n\n". + 'This sort of workflow is very unusual. Very few installs should '. + 'need to change this option.')), $this->newOption('differential.days-fresh', 'int', 1) ->setSummary( pht( diff --git a/src/applications/differential/constants/DifferentialRevisionStatus.php b/src/applications/differential/constants/DifferentialRevisionStatus.php index 95576fc80b..a35e00e9cc 100644 --- a/src/applications/differential/constants/DifferentialRevisionStatus.php +++ b/src/applications/differential/constants/DifferentialRevisionStatus.php @@ -72,10 +72,16 @@ final class DifferentialRevisionStatus { } public static function getClosedStatuses() { - return array( + $statuses = array( ArcanistDifferentialRevisionStatus::CLOSED, ArcanistDifferentialRevisionStatus::ABANDONED, ); + + if (PhabricatorEnv::getEnvConfig('differential.close-on-accept')) { + $statuses[] = ArcanistDifferentialRevisionStatus::ACCEPTED; + } + + return $statuses; } public static function getOpenStatuses() {