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

Order actions sensibly within Differential revision comment action groups

Summary:
Ref T11114. See D17114 for some discussion.

For review actions: accept, reject, resign.

For revision actions, order is basically least-severe to most-severe action pairs: plan changes, request review, close, reopen, abandon, reclaim, commandeer.

Test Plan: Viewed revisions as an author and a reviewer, saw sensible action order within action groups.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

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

+63
+2
src/applications/differential/editor/DifferentialRevisionEditEngine.php
··· 229 229 ->setValue(array()); 230 230 231 231 $actions = DifferentialRevisionActionTransaction::loadAllActions(); 232 + $actions = msortv($actions, 'getRevisionActionOrderVector'); 233 + 232 234 foreach ($actions as $key => $action) { 233 235 $fields[] = $action->newEditField($object, $viewer); 234 236 }
+5
src/applications/differential/storage/DifferentialRevision.php
··· 447 447 return ($this->getStatus() == $status_abandoned); 448 448 } 449 449 450 + public function isAccepted() { 451 + $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED; 452 + return ($this->getStatus() == $status_accepted); 453 + } 454 + 450 455 public function getStatusIcon() { 451 456 $map = array( 452 457 ArcanistDifferentialRevisionStatus::NEEDS_REVIEW
+4
src/applications/differential/xaction/DifferentialRevisionAbandonTransaction.php
··· 22 22 return 'indigo'; 23 23 } 24 24 25 + protected function getRevisionActionOrder() { 26 + return 500; 27 + } 28 + 25 29 public function generateOldValue($object) { 26 30 return $object->isAbandoned(); 27 31 }
+4
src/applications/differential/xaction/DifferentialRevisionAcceptTransaction.php
··· 22 22 return 'green'; 23 23 } 24 24 25 + protected function getRevisionActionOrder() { 26 + return 500; 27 + } 28 + 25 29 public function generateOldValue($object) { 26 30 $actor = $this->getActor(); 27 31 return $this->isViewerAcceptingReviewer($object, $actor);
+9
src/applications/differential/xaction/DifferentialRevisionActionTransaction.php
··· 19 19 abstract protected function validateAction($object, PhabricatorUser $viewer); 20 20 abstract protected function getRevisionActionLabel(); 21 21 22 + protected function getRevisionActionOrder() { 23 + return 1000; 24 + } 25 + 26 + public function getRevisionActionOrderVector() { 27 + return id(new PhutilSortVector()) 28 + ->addInt($this->getRevisionActionOrder()); 29 + } 30 + 22 31 protected function getRevisionActionGroupKey() { 23 32 return DifferentialRevisionEditEngine::ACTIONGROUP_REVISION; 24 33 }
+11
src/applications/differential/xaction/DifferentialRevisionCloseTransaction.php
··· 22 22 return 'indigo'; 23 23 } 24 24 25 + protected function getRevisionActionOrder() { 26 + return 300; 27 + } 28 + 25 29 public function generateOldValue($object) { 26 30 return $object->isClosed(); 27 31 } ··· 47 51 pht( 48 52 'You can not close this revision because it has already been '. 49 53 'closed. Only open revisions can be closed.')); 54 + } 55 + 56 + if (!$object->isAccepted()) { 57 + throw new Exception( 58 + pht( 59 + 'You can not close this revision because it has not been accepted. '. 60 + 'Revisions must be accepted before they can be closed.')); 50 61 } 51 62 52 63 $config_key = 'differential.always-allow-close';
+4
src/applications/differential/xaction/DifferentialRevisionCommandeerTransaction.php
··· 22 22 return 'sky'; 23 23 } 24 24 25 + protected function getRevisionActionOrder() { 26 + return 700; 27 + } 28 + 25 29 public function generateOldValue($object) { 26 30 return $object->getAuthorPHID(); 27 31 }
+4
src/applications/differential/xaction/DifferentialRevisionPlanChangesTransaction.php
··· 23 23 return 'red'; 24 24 } 25 25 26 + protected function getRevisionActionOrder() { 27 + return 200; 28 + } 29 + 26 30 public function generateOldValue($object) { 27 31 $status_planned = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED; 28 32 return ($object->getStatus() == $status_planned);
+4
src/applications/differential/xaction/DifferentialRevisionReclaimTransaction.php
··· 22 22 return 'sky'; 23 23 } 24 24 25 + protected function getRevisionActionOrder() { 26 + return 600; 27 + } 28 + 25 29 public function generateOldValue($object) { 26 30 return !$object->isAbandoned(); 27 31 }
+4
src/applications/differential/xaction/DifferentialRevisionRejectTransaction.php
··· 22 22 return 'red'; 23 23 } 24 24 25 + protected function getRevisionActionOrder() { 26 + return 600; 27 + } 28 + 25 29 public function generateOldValue($object) { 26 30 $actor = $this->getActor(); 27 31 return $this->isViewerRejectingReviewer($object, $actor);
+4
src/applications/differential/xaction/DifferentialRevisionReopenTransaction.php
··· 22 22 return 'sky'; 23 23 } 24 24 25 + protected function getRevisionActionOrder() { 26 + return 400; 27 + } 28 + 25 29 public function generateOldValue($object) { 26 30 return !$object->isClosed(); 27 31 }
+4
src/applications/differential/xaction/DifferentialRevisionRequestReviewTransaction.php
··· 18 18 return 'sky'; 19 19 } 20 20 21 + protected function getRevisionActionOrder() { 22 + return 200; 23 + } 24 + 21 25 public function generateOldValue($object) { 22 26 $status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW; 23 27 return ($object->getStatus() == $status_review);
+4
src/applications/differential/xaction/DifferentialRevisionResignTransaction.php
··· 22 22 return 'orange'; 23 23 } 24 24 25 + protected function getRevisionActionOrder() { 26 + return 700; 27 + } 28 + 25 29 public function generateOldValue($object) { 26 30 $actor = $this->getActor(); 27 31 return !$this->isViewerAnyReviewer($object, $actor);