@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.

A closed commit can be reopened, if allowed by the config file.

Summary: Fixes T2316

Test Plan:
When the config file allows reopening,
navigate to a closed revision and reopen it in the user interface,
and verify that the revision now "needs review."
Also checks that the reopen option is unavailable when disallowed
by the config file.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2316

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

authored by

Nick Pellegrino and committed by
epriestley
38020070 a8bd1f49

+43
+6
conf/default.conf.php
··· 1052 1052 // only the submitter can close a revision. 1053 1053 'differential.always-allow-close' => false, 1054 1054 1055 + // If you set this to true, any user can reopen a revision so long as it has 1056 + // been closed. This can be useful if a revision is accidentally closed or 1057 + // if a developer changes his or her mind after closing a revision. If it is 1058 + // false, reopening is not allowed. 1059 + 'differential.allow-reopen' => false, 1060 + 1055 1061 // Revisions newer than this number of days are marked as fresh in Action 1056 1062 // Required and Revisions Waiting on You views. Only work days (not weekends 1057 1063 // and holidays) are included. Set to 0 to disable this feature.
+13
src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
··· 183 183 "where the reviewer is often the actual committer can benefit ". 184 184 "from turning this option to true. If false, only the submitter ". 185 185 "can close a revision.")), 186 + $this->newOption('differential.allow-reopen', 'bool', false) 187 + ->setBoolOptions( 188 + array( 189 + pht("Enable reopen"), 190 + pht("Disable reopen"), 191 + )) 192 + ->setSummary(pht("Allows any user to reopen a closed revision.")) 193 + ->setDescription( 194 + pht("If you set this to true, any user can reopen a revision so ". 195 + "long as it has been closed. This can be useful if a revision ". 196 + "is accidentally closed or if a developer changes his or her ". 197 + "mind after closing a revision. If it is false, reopening ". 198 + "is not allowed.")), 186 199 $this->newOption('differential.days-fresh', 'int', 1) 187 200 ->setSummary( 188 201 pht(
+3
src/applications/differential/constants/DifferentialAction.php
··· 18 18 const ACTION_ADDREVIEWERS = 'add_reviewers'; 19 19 const ACTION_ADDCCS = 'add_ccs'; 20 20 const ACTION_CLAIM = 'claim'; 21 + const ACTION_REOPEN = 'reopen'; 21 22 22 23 public static function getActionPastTenseVerb($action) { 23 24 $verbs = array( ··· 37 38 self::ACTION_ADDREVIEWERS => 'added reviewers to', 38 39 self::ACTION_ADDCCS => 'added CCs to', 39 40 self::ACTION_CLAIM => 'commandeered', 41 + self::ACTION_REOPEN => 'reopened', 40 42 ); 41 43 42 44 if (!empty($verbs[$action])) { ··· 60 62 self::ACTION_ADDCCS => 'Add CCs', 61 63 self::ACTION_CLOSE => 'Close Revision', 62 64 self::ACTION_CLAIM => 'Commandeer Revision', 65 + self::ACTION_REOPEN => 'Reopen', 63 66 ); 64 67 65 68 if (!empty($verbs[$action])) {
+4
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 565 565 'differential.allow-self-accept', false); 566 566 $always_allow_close = PhabricatorEnv::getEnvConfig( 567 567 'differential.always-allow-close', false); 568 + $allow_reopen = PhabricatorEnv::getEnvConfig( 569 + 'differential.allow-reopen', false); 568 570 569 571 if ($viewer_is_owner) { 570 572 switch ($status) { ··· 618 620 619 621 $actions[DifferentialAction::ACTION_ADDREVIEWERS] = true; 620 622 $actions[DifferentialAction::ACTION_ADDCCS] = true; 623 + $actions[DifferentialAction::ACTION_REOPEN] = $allow_reopen && 624 + ($status == ArcanistDifferentialRevisionStatus::CLOSED); 621 625 622 626 $actions = array_keys(array_filter($actions)); 623 627 $actions_dict = array();
+17
src/applications/differential/editor/DifferentialCommentEditor.php
··· 102 102 'differential.allow-self-accept', false); 103 103 $always_allow_close = PhabricatorEnv::getEnvConfig( 104 104 'differential.always-allow-close', false); 105 + $allow_reopen = PhabricatorEnv::getEnvConfig( 106 + 'differential.allow-reopen', false); 105 107 $revision_status = $revision->getStatus(); 106 108 107 109 $revision->loadRelationships(); ··· 358 360 } 359 361 360 362 $revision->setStatus(ArcanistDifferentialRevisionStatus::CLOSED); 363 + break; 364 + 365 + case DifferentialAction::ACTION_REOPEN: 366 + if (!$allow_reopen) { 367 + throw new Exception( 368 + "You cannot reopen a revision when this action is disabled."); 369 + } 370 + 371 + if ($revision_status != ArcanistDifferentialRevisionStatus::CLOSED) { 372 + throw new Exception( 373 + "You cannot reopen a revision that is not currently closed."); 374 + } 375 + 376 + $revision->setStatus(ArcanistDifferentialRevisionStatus::NEEDS_REVIEW); 377 + 361 378 break; 362 379 363 380 case DifferentialAction::ACTION_ADDREVIEWERS: