Page MenuHomePhabricator

D9306.id.diff
No OneTemporary

D9306.id.diff

diff --git a/conf/default.conf.php b/conf/default.conf.php
--- a/conf/default.conf.php
+++ b/conf/default.conf.php
@@ -811,6 +811,10 @@
// only the submitter can close a revision.
'differential.always-allow-close' => false,
+ // If you set this to true, any user can abandon any revision. If false, only
+ // the submitter can abandon a revision.
+ 'differential.always-allow-abandon' => false,
+
// If you set this to true, any user can reopen a revision so long as it has
// been closed. This can be useful if a revision is accidentally closed or
// if a developer changes his or her mind after closing a revision. If it is
diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
--- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
+++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
@@ -165,6 +165,17 @@
"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.")),
+ $this->newOption('differential.always-allow-abandon', 'bool', false)
+ ->setBoolOptions(
+ array(
+ pht('Allow any user'),
+ pht('Restrict to submitter'),
+ ))
+ ->setSummary(pht('Allows any user to abandon revisions.'))
+ ->setDescription(
+ pht(
+ 'If you set this to true, any user can abandon any revision. If '.
+ 'false, only the submitter can abandon a revision.')),
$this->newOption('differential.allow-reopen', 'bool', false)
->setBoolOptions(
array(
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -553,6 +553,8 @@
$allow_self_accept = PhabricatorEnv::getEnvConfig(
'differential.allow-self-accept');
+ $always_allow_abandon = PhabricatorEnv::getEnvConfig(
+ 'differential.always-allow-abandon');
$always_allow_close = PhabricatorEnv::getEnvConfig(
'differential.always-allow-close');
$allow_reopen = PhabricatorEnv::getEnvConfig(
@@ -586,17 +588,20 @@
} else {
switch ($status) {
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
+ $actions[DifferentialAction::ACTION_ABANDON] = $always_allow_abandon;
$actions[DifferentialAction::ACTION_ACCEPT] = true;
$actions[DifferentialAction::ACTION_REJECT] = true;
$actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
break;
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
+ $actions[DifferentialAction::ACTION_ABANDON] = $always_allow_abandon;
$actions[DifferentialAction::ACTION_ACCEPT] = true;
$actions[DifferentialAction::ACTION_REJECT] = !$viewer_has_rejected;
$actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
break;
case ArcanistDifferentialRevisionStatus::ACCEPTED:
+ $actions[DifferentialAction::ACTION_ABANDON] = $always_allow_abandon;
$actions[DifferentialAction::ACTION_ACCEPT] = !$viewer_has_accepted;
$actions[DifferentialAction::ACTION_REJECT] = true;
$actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer;
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -789,6 +789,9 @@
$actor_phid = $this->getActor()->getPHID();
$actor_is_author = ($author_phid == $actor_phid);
+ $config_abandon_key = 'differential.always-allow-abandon';
+ $always_allow_abandon = PhabricatorEnv::getEnvConfig($config_abandon_key);
+
$config_close_key = 'differential.always-allow-close';
$always_allow_close = PhabricatorEnv::getEnvConfig($config_close_key);
@@ -860,7 +863,7 @@
break;
case DifferentialAction::ACTION_ABANDON:
- if (!$actor_is_author) {
+ if (!$actor_is_author && !$always_allow_abandon) {
return pht(
"You can not abandon this revision because you do not own it. ".
"You can only abandon revisions you own.");

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 12:58 AM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704802
Default Alt Text
D9306.id.diff (4 KB)

Event Timeline