Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14444060
D11999.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
D11999.diff
View Options
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
@@ -38,6 +38,7 @@
private $branches = array();
private $arcanistProjectPHIDs = array();
private $repositoryPHIDs;
+ private $anyProjectPHIDs = array();
private $order = 'order-modified';
const ORDER_MODIFIED = 'order-modified';
@@ -253,6 +254,10 @@
return $this;
}
+ public function withAnyProjects(array $projects) {
+ $this->anyProjectPHIDs = $projects;
+ return $this;
+ }
/**
* Set result ordering. Provide a class constant, such as
@@ -675,6 +680,16 @@
DifferentialRevision::TABLE_COMMIT);
}
+ if ($this->anyProjectPHIDs) {
+ $edge_table = PhabricatorEdgeConfig::TABLE_NAME_EDGE;
+ $joins[] = qsprintf(
+ $conn_r,
+ 'JOIN %T anyproject ON anyproject.src = r.phid
+ AND anyproject.type = %d',
+ $edge_table,
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
+ }
+
$joins = implode(' ', $joins);
return $joins;
@@ -817,9 +832,21 @@
}
$where[] = $this->buildPagingClause($conn_r);
+ $where[] = $this->buildAnyProjectWhereClause($conn_r);
+
return $this->formatWhereClause($where);
}
+ private function buildAnyProjectWhereClause(AphrontDatabaseConnection $conn) {
+ if (!$this->anyProjectPHIDs) {
+ return null;
+ }
+
+ return qsprintf(
+ $conn,
+ 'anyproject.dst IN (%Ls)',
+ $this->anyProjectPHIDs);
+ }
/**
* @task internal
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
@@ -43,6 +43,10 @@
$this->readUsersFromRequest($request, 'subscribers'));
$saved->setParameter(
+ 'anyProjectPHIDs',
+ $this->readPHIDsFromRequest($request, 'anyProjects'));
+
+ $saved->setParameter(
'repositoryPHIDs',
$request->getArr('repositories'));
@@ -92,6 +96,11 @@
$query->withRepositoryPHIDs($repository_phids);
}
+ $any_project_phids = $saved->getParameter('anyProjectPHIDs');
+ if ($any_project_phids) {
+ $query->withAnyProjects($any_project_phids);
+ }
+
$draft = $saved->getParameter('draft', false);
if ($draft && $this->requireViewer()->isLoggedIn()) {
$query->withDraftRepliesByAuthors(
@@ -122,6 +131,8 @@
$reviewer_phids = $saved->getParameter('reviewerPHIDs', array());
$subscriber_phids = $saved->getParameter('subscriberPHIDs', array());
$repository_phids = $saved->getParameter('repositoryPHIDs', array());
+ $any_project_phids = $saved->getParameter('anyProjectPHIDs', array());
+
$only_draft = $saved->getParameter('draft', false);
$all_phids = array_mergev(
@@ -131,6 +142,7 @@
$reviewer_phids,
$subscriber_phids,
$repository_phids,
+ $any_project_phids,
));
$handles = id(new PhabricatorHandleQuery())
@@ -170,6 +182,12 @@
->setDatasource(new DiffusionRepositoryDatasource())
->setValue(array_select_keys($handles, $repository_phids)))
->appendChild(
+ id(new AphrontFormTokenizerControl())
+ ->setLabel(pht('In Any Project'))
+ ->setName('anyProjects')
+ ->setDatasource(new PhabricatorProjectDatasource())
+ ->setValue(array_select_keys($handles, $any_project_phids)))
+ ->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Status'))
->setName('status')
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 11:02 AM (9 h, 24 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6931649
Default Alt Text
D11999.diff (3 KB)
Attached To
Mode
D11999: Add filter by "In Any Project" to differencial search
Attached
Detach File
Event Timeline
Log In to Comment