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

Opt-in approve your own Differential revisions

Summary: Did exactly what @epriestley suggested in T1428#2.

Test Plan: Turn it on in your config, post a revision, accept it. Turn it off in your config, post a revision, can't accept it.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

authored by

Jonathan Lomas and committed by
epriestley
c821639e 948259ee

+14 -2
+6 -1
conf/default.conf.php
··· 943 943 'differential.anonymous-access' => false, 944 944 945 945 // List of file regexps that should be treated as if they are generated by 946 - // an automatic process, and thus get hidden by default in differential 946 + // an automatic process, and thus get hidden by default in differential. 947 947 'differential.generated-paths' => array( 948 948 // '/config\.h$/', 949 949 // '#/autobuilt/#', 950 950 ), 951 951 952 + // If you set this to true, users can accept their own revisions. This action 953 + // is disabled by default because it's most likely not a behavior you want, 954 + // but it proves useful if you are working alone on a project and want to make 955 + // use of all of differential's features. 956 + 'differential.allow-self-accept' => false, 952 957 953 958 // -- Maniphest ------------------------------------------------------------- // 954 959
+5
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 536 536 $viewer_did_accept = ($viewer_phid === $revision->loadReviewedBy()); 537 537 $status = $revision->getStatus(); 538 538 539 + $allow_self_accept = PhabricatorEnv::getEnvConfig( 540 + 'differential.allow-self-accept', false); 541 + 539 542 if ($viewer_is_owner) { 540 543 switch ($status) { 541 544 case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: 545 + $actions[DifferentialAction::ACTION_ACCEPT] = $allow_self_accept; 542 546 $actions[DifferentialAction::ACTION_ABANDON] = true; 543 547 $actions[DifferentialAction::ACTION_RETHINK] = true; 544 548 break; 545 549 case ArcanistDifferentialRevisionStatus::NEEDS_REVISION: 550 + $actions[DifferentialAction::ACTION_ACCEPT] = $allow_self_accept; 546 551 $actions[DifferentialAction::ACTION_ABANDON] = true; 547 552 $actions[DifferentialAction::ACTION_REQUEST] = true; 548 553 break;
+3 -1
src/applications/differential/editor/DifferentialCommentEditor.php
··· 111 111 $actor_phid = $this->actorPHID; 112 112 $actor = id(new PhabricatorUser())->loadOneWhere('PHID = %s', $actor_phid); 113 113 $actor_is_author = ($actor_phid == $revision->getAuthorPHID()); 114 + $allow_self_accept = PhabricatorEnv::getEnvConfig( 115 + 'differential.allow-self-accept', false); 114 116 $revision_status = $revision->getStatus(); 115 117 116 118 $revision->loadRelationships(); ··· 176 178 break; 177 179 178 180 case DifferentialAction::ACTION_ACCEPT: 179 - if ($actor_is_author) { 181 + if ($actor_is_author && !$allow_self_accept) { 180 182 throw new Exception('You can not accept your own revision.'); 181 183 } 182 184 if (($revision_status !=