Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14747476
D18339.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Referenced Files
None
Subscribers
None
D18339.diff
View Options
diff --git a/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php
@@ -88,9 +88,7 @@
'uri' => PhabricatorEnv::getProductionURI('/D'.$id),
'dateCreated' => $revision->getDateCreated(),
'authorPHID' => $revision->getAuthorPHID(),
- 'statusName' =>
- ArcanistDifferentialRevisionStatus::getNameForRevisionStatus(
- $revision->getStatus()),
+ 'statusName' => $revision->getStatusDisplayName(),
'sourcePath' => $diff->getSourcePath(),
);
}
diff --git a/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialGetRevisionConduitAPIMethod.php
@@ -83,9 +83,7 @@
'uri' => PhabricatorEnv::getURI('/D'.$revision->getID()),
'title' => $revision->getTitle(),
'status' => $revision->getStatus(),
- 'statusName' =>
- ArcanistDifferentialRevisionStatus::getNameForRevisionStatus(
- $revision->getStatus()),
+ 'statusName' => $revision->getStatusDisplayName(),
'summary' => $revision->getSummary(),
'testPlan' => $revision->getTestPlan(),
'lineCount' => $revision->getLineCount(),
diff --git a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
@@ -221,9 +221,7 @@
'dateModified' => $revision->getDateModified(),
'authorPHID' => $revision->getAuthorPHID(),
'status' => $revision->getStatus(),
- 'statusName' =>
- ArcanistDifferentialRevisionStatus::getNameForRevisionStatus(
- $revision->getStatus()),
+ 'statusName' => $revision->getStatusDisplayName(),
'properties' => $revision->getProperties(),
'branch' => $diff->getBranch(),
'summary' => $revision->getSummary(),
diff --git a/src/applications/differential/customfield/DifferentialBranchField.php b/src/applications/differential/customfield/DifferentialBranchField.php
--- a/src/applications/differential/customfield/DifferentialBranchField.php
+++ b/src/applications/differential/customfield/DifferentialBranchField.php
@@ -76,16 +76,17 @@
PhabricatorApplicationTransactionEditor $editor,
array $xactions) {
- $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
+ $revision = $this->getObject();
// Show the "BRANCH" section only if there's a new diff or the revision
// is "Accepted".
- if ((!$editor->getDiffUpdateTransaction($xactions)) &&
- ($this->getObject()->getStatus() != $status_accepted)) {
+ $is_update = (bool)$editor->getDiffUpdateTransaction($xactions);
+ $is_accepted = $revision->isAccepted();
+ if (!$is_update && !$is_accepted) {
return;
}
- $branch = $this->getBranchDescription($this->getObject()->getActiveDiff());
+ $branch = $this->getBranchDescription($revision->getActiveDiff());
if ($branch === null) {
return;
}
diff --git a/src/applications/differential/customfield/DifferentialReviewersField.php b/src/applications/differential/customfield/DifferentialReviewersField.php
--- a/src/applications/differential/customfield/DifferentialReviewersField.php
+++ b/src/applications/differential/customfield/DifferentialReviewersField.php
@@ -68,8 +68,7 @@
public function getWarningsForRevisionHeader(array $handles) {
$revision = $this->getObject();
- $status_needs_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
- if ($revision->getStatus() != $status_needs_review) {
+ if (!$revision->isNeedsReview()) {
return array();
}
diff --git a/src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php b/src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php
--- a/src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php
+++ b/src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php
@@ -35,8 +35,7 @@
}
public function getActiveUserPHIDs($object) {
- $status = $object->getStatus();
- if ($status == ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) {
+ if ($object->isNeedsReview()) {
return $object->getReviewerPHIDs();
} else {
return array();
@@ -44,8 +43,7 @@
}
public function getPassiveUserPHIDs($object) {
- $status = $object->getStatus();
- if ($status == ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) {
+ if ($object->isNeedsReview()) {
return array();
} else {
return $object->getReviewerPHIDs();
diff --git a/src/applications/differential/phid/DifferentialRevisionPHIDType.php b/src/applications/differential/phid/DifferentialRevisionPHIDType.php
--- a/src/applications/differential/phid/DifferentialRevisionPHIDType.php
+++ b/src/applications/differential/phid/DifferentialRevisionPHIDType.php
@@ -50,8 +50,7 @@
$icon = DifferentialRevisionStatus::getRevisionStatusIcon($status);
$color = DifferentialRevisionStatus::getRevisionStatusColor($status);
- $name = ArcanistDifferentialRevisionStatus::getNameForRevisionStatus(
- $status);
+ $name = $revision->getStatusDisplayName();
$handle
->setStateIcon($icon)
diff --git a/src/applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php b/src/applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php
--- a/src/applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php
+++ b/src/applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php
@@ -134,13 +134,11 @@
}
private function filterShouldLand(array $phids) {
- $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
-
$objects = $this->getRevisionsAuthored($this->objects, $phids);
$results = array();
foreach ($objects as $key => $object) {
- if ($object->getStatus() != $status_accepted) {
+ if (!$object->isAccepted()) {
continue;
}
@@ -175,13 +173,11 @@
}
private function filterWaitingForReview(array $phids) {
- $status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
-
$objects = $this->getRevisionsAuthored($this->objects, $phids);
$results = array();
foreach ($objects as $key => $object) {
- if ($object->getStatus() != $status_review) {
+ if (!$object->isNeedsReview()) {
continue;
}
@@ -217,16 +213,11 @@
}
private function filterWaitingOnOtherReviewers(array $phids) {
- $statuses = array(
- ArcanistDifferentialRevisionStatus::NEEDS_REVIEW,
- );
- $statuses = array_fuse($statuses);
-
$objects = $this->getRevisionsNotAuthored($this->objects, $phids);
$results = array();
foreach ($objects as $key => $object) {
- if (!isset($statuses[$object->getStatus()])) {
+ if (!$object->isNeedsReview()) {
continue;
}
diff --git a/src/applications/differential/query/DifferentialRevisionResultBucket.php b/src/applications/differential/query/DifferentialRevisionResultBucket.php
--- a/src/applications/differential/query/DifferentialRevisionResultBucket.php
+++ b/src/applications/differential/query/DifferentialRevisionResultBucket.php
@@ -15,9 +15,8 @@
$objects = $this->getRevisionsNotAuthored($objects, $phids);
- $status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
foreach ($objects as $key => $object) {
- if ($object->getStatus() != $status_review) {
+ if (!$object->isNeedsReview()) {
continue;
}
diff --git a/src/applications/differential/query/DifferentialRevisionSearchEngine.php b/src/applications/differential/query/DifferentialRevisionSearchEngine.php
--- a/src/applications/differential/query/DifferentialRevisionSearchEngine.php
+++ b/src/applications/differential/query/DifferentialRevisionSearchEngine.php
@@ -235,11 +235,9 @@
}
private function loadUnlandedDependencies(array $revisions) {
- $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
-
$phids = array();
foreach ($revisions as $revision) {
- if ($revision->getStatus() != $status_accepted) {
+ if (!$revision->isAccepted()) {
continue;
}
diff --git a/src/applications/differential/search/DifferentialRevisionFulltextEngine.php b/src/applications/differential/search/DifferentialRevisionFulltextEngine.php
--- a/src/applications/differential/search/DifferentialRevisionFulltextEngine.php
+++ b/src/applications/differential/search/DifferentialRevisionFulltextEngine.php
@@ -34,8 +34,7 @@
// If a revision needs review, the owners are the reviewers. Otherwise, the
// owner is the author (e.g., accepted, rejected, closed).
- $status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
- if ($revision->getStatus() == $status_review) {
+ if ($revision->isNeedsReview()) {
$reviewers = $revision->getReviewerPHIDs();
$reviewers = array_fuse($reviewers);
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -626,6 +626,11 @@
return ($this->getStatus() == $status_accepted);
}
+ public function isNeedsReview() {
+ $status_review = ArcanistDifferentialRevisionStatus::NEEDS_REVIEW;
+ return ($this->getStatus() == $status_review);
+ }
+
public function getStatusIcon() {
$map = array(
ArcanistDifferentialRevisionStatus::NEEDS_REVIEW
diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitFieldsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitFieldsQuery.php
--- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitFieldsQuery.php
+++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitFieldsQuery.php
@@ -122,9 +122,8 @@
$revisions = array_reverse($revisions);
// Try to find an accepted revision first.
- $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
foreach ($revisions as $revision) {
- if ($revision->getStatus() == $status_accepted) {
+ if ($revision->isAccepted()) {
return $revision;
}
}
diff --git a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
--- a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
+++ b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
@@ -289,31 +289,30 @@
);
}
- $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
- if ($revision->getStatus() != $status_accepted) {
- switch ($revision->getStatus()) {
- case ArcanistDifferentialRevisionStatus::CLOSED:
- return array(
- 'title' => pht('Revision Closed'),
- 'body' => pht(
- 'This revision has already been closed. Only open, accepted '.
- 'revisions may land.'),
- );
- case ArcanistDifferentialRevisionStatus::ABANDONED:
- return array(
- 'title' => pht('Revision Abandoned'),
- 'body' => pht(
- 'This revision has been abandoned. Only accepted revisions '.
- 'may land.'),
- );
- default:
- return array(
- 'title' => pht('Revision Not Accepted'),
- 'body' => pht(
- 'This revision is still under review. Only revisions which '.
- 'have been accepted may land.'),
- );
- }
+ if ($revision->isAccepted()) {
+ // We can land accepted revisions, so continue below. Otherwise, raise
+ // an error with tailored messaging for the most common cases.
+ } else if ($revision->isAbandoned()) {
+ return array(
+ 'title' => pht('Revision Abandoned'),
+ 'body' => pht(
+ 'This revision has been abandoned. Only accepted revisions '.
+ 'may land.'),
+ );
+ } else if ($revision->isClosed()) {
+ return array(
+ 'title' => pht('Revision Closed'),
+ 'body' => pht(
+ 'This revision has already been closed. Only open, accepted '.
+ 'revisions may land.'),
+ );
+ } else {
+ return array(
+ 'title' => pht('Revision Not Accepted'),
+ 'body' => pht(
+ 'This revision is still under review. Only revisions which '.
+ 'have been accepted may land.'),
+ );
}
// Check for other operations. Eventually this should probably be more
diff --git a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
--- a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
+++ b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
@@ -79,8 +79,7 @@
return null;
}
- $status = $this->getRevision()->getStatus();
- if ($status == ArcanistDifferentialRevisionStatus::CLOSED) {
+ if ($this->getRevision()->isClosed()) {
$verb = $tense[$this->releephAction]['past'];
} else {
$verb = $tense[$this->releephAction]['future'];
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 10:07 AM (5 h, 50 s)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7029923
Default Alt Text
D18339.diff (13 KB)
Attached To
Mode
D18339: Reduce callsites to "ArcanistDifferentialRevisionStatus" in Phabricator
Attached
Detach File
Event Timeline
Log In to Comment