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

Reduce STATUS_CLOSED (now internally "Published") revision status callsites

Summary:
Ref T2543. Add `isPublished()` to mean: exactly the status 'closed', which is now interally called 'published', but still shown as 'closed' to users.

We have some callsites which are about "exactly that status", vs "any 'closed' status", e.g. including "abandoned".

This also introduces `isChangePlanned()`, which felt less awkward than `isChangesPlanned()` but more consistent than `hasChangesPlanned()` or `isStatusChangesPlanned()` or similar.

Test Plan: `grep`, loaded revisions, requested review.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T2543

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

+21 -14
+1 -1
src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php
··· 69 69 throw new ConduitException('ERR_BAD_REVISION'); 70 70 } 71 71 72 - if ($revision->getStatus() == ArcanistDifferentialRevisionStatus::CLOSED) { 72 + if ($revision->isPublished()) { 73 73 throw new ConduitException('ERR_CLOSED'); 74 74 } 75 75
+8
src/applications/differential/constants/DifferentialRevisionStatus.php
··· 44 44 return ($this->key === self::NEEDS_REVIEW); 45 45 } 46 46 47 + public function isPublished() { 48 + return ($this->key === self::PUBLISHED); 49 + } 50 + 51 + public function isChangePlanned() { 52 + return ($this->key === self::CHANGES_PLANNED); 53 + } 54 + 47 55 public static function newForLegacyStatus($legacy_status) { 48 56 $result = new self(); 49 57
+8
src/applications/differential/storage/DifferentialRevision.php
··· 628 628 return $this->getStatusObject()->isNeedsReview(); 629 629 } 630 630 631 + public function isChangePlanned() { 632 + return $this->getStatusObject()->isChangePlanned(); 633 + } 634 + 635 + public function isPublished() { 636 + return $this->getStatusObject()->isPublished(); 637 + } 638 + 631 639 public function getStatusIcon() { 632 640 return $this->getStatusObject()->getIcon(); 633 641 }
+1 -3
src/applications/differential/xaction/DifferentialRevisionPlanChangesTransaction.php
··· 56 56 } 57 57 58 58 protected function validateAction($object, PhabricatorUser $viewer) { 59 - $status_planned = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED; 60 - 61 - if ($object->getStatus() == $status_planned) { 59 + if ($object->isChangePlanned()) { 62 60 throw new Exception( 63 61 pht( 64 62 'You can not request review of this revision because this '.
+1 -4
src/applications/differential/xaction/DifferentialRevisionReopenTransaction.php
··· 39 39 } 40 40 41 41 protected function validateAction($object, PhabricatorUser $viewer) { 42 - // Note that we're testing for "Closed", exactly, not just any closed 43 - // status. 44 - $status_closed = ArcanistDifferentialRevisionStatus::CLOSED; 45 - if ($object->getStatus() != $status_closed) { 42 + if ($object->isPublished()) { 46 43 throw new Exception( 47 44 pht( 48 45 'You can not reopen this revision because it is not closed. '.
+1 -2
src/applications/differential/xaction/DifferentialRevisionRequestReviewTransaction.php
··· 37 37 } 38 38 39 39 protected function validateAction($object, PhabricatorUser $viewer) { 40 - $status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW; 41 - if ($object->getStatus() == $status_review) { 40 + if ($object->isNeedsReview()) { 42 41 throw new Exception( 43 42 pht( 44 43 'You can not request review of this revision because this '.
+1 -4
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
··· 203 203 $revision->getID(), 204 204 $commit->getPHID()); 205 205 206 - $status_closed = ArcanistDifferentialRevisionStatus::CLOSED; 207 - $should_close = ($revision->getStatus() != $status_closed) && 208 - $should_autoclose; 209 - 206 + $should_close = !$revision->isPublished() && $should_autoclose; 210 207 if ($should_close) { 211 208 $commit_close_xaction = id(new DifferentialTransaction()) 212 209 ->setTransactionType(DifferentialTransaction::TYPE_ACTION)