Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14745873
D18395.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D18395.diff
View Options
diff --git a/src/applications/differential/controller/DifferentialDiffViewController.php b/src/applications/differential/controller/DifferentialDiffViewController.php
--- a/src/applications/differential/controller/DifferentialDiffViewController.php
+++ b/src/applications/differential/controller/DifferentialDiffViewController.php
@@ -177,7 +177,7 @@
$revisions = id(new DifferentialRevisionQuery())
->setViewer($viewer)
->withAuthors(array($viewer->getPHID()))
- ->withStatus(DifferentialLegacyQuery::STATUS_OPEN)
+ ->withIsOpen(true)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -808,7 +808,7 @@
$query = id(new DifferentialRevisionQuery())
->setViewer($this->getRequest()->getUser())
- ->withStatus(DifferentialLegacyQuery::STATUS_OPEN)
+ ->withIsOpen(true)
->withUpdatedEpochBetween($recent, null)
->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED)
->setLimit(10)
diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php
--- a/src/applications/differential/query/DifferentialRevisionQuery.php
+++ b/src/applications/differential/query/DifferentialRevisionQuery.php
@@ -26,6 +26,7 @@
private $updatedEpochMin;
private $updatedEpochMax;
private $statuses;
+ private $isOpen;
const ORDER_MODIFIED = 'order-modified';
const ORDER_CREATED = 'order-created';
@@ -152,6 +153,11 @@
return $this;
}
+ public function withIsOpen($is_open) {
+ $this->isOpen = $is_open;
+ return $this;
+ }
+
/**
* Filter results to revisions on given branches.
@@ -718,6 +724,20 @@
DifferentialLegacyQuery::getLegacyValues($this->statuses));
}
+ if ($this->isOpen !== null) {
+ if ($this->isOpen) {
+ $statuses = DifferentialLegacyQuery::getQueryValues(
+ DifferentialLegacyQuery::STATUS_OPEN);
+ } else {
+ $statuses = DifferentialLegacyQuery::getQueryValues(
+ DifferentialLegacyQuery::STATUS_CLOSED);
+ }
+ $where[] = qsprintf(
+ $conn_r,
+ 'r.status in (%Ls)',
+ $statuses);
+ }
+
$where[] = $this->buildWhereClauseParts($conn_r);
return $this->formatWhereClause($where);
}
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
@@ -268,7 +268,7 @@
$blocking_revisions = id(new DifferentialRevisionQuery())
->setViewer($viewer)
->withPHIDs($revision_phids)
- ->withStatus(DifferentialLegacyQuery::STATUS_OPEN)
+ ->withIsOpen(true)
->execute();
$blocking_revisions = mpull($blocking_revisions, null, 'getPHID');
diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php
--- a/src/applications/diffusion/controller/DiffusionBrowseController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseController.php
@@ -1758,7 +1758,7 @@
$revisions = id(new DifferentialRevisionQuery())
->setViewer($viewer)
->withPath($repository->getID(), $path_id)
- ->withStatus(DifferentialLegacyQuery::STATUS_OPEN)
+ ->withIsOpen(true)
->withUpdatedEpochBetween($recent, null)
->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED)
->setLimit(10)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 9:34 AM (4 h, 36 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7025879
Default Alt Text
D18395.diff (3 KB)
Attached To
Mode
D18395: Replace legacy Differential queries for "open" revisions with a modern mechanism
Attached
Detach File
Event Timeline
Log In to Comment