Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15375802
D9724.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
D9724.diff
View Options
diff --git a/src/applications/pholio/query/PholioMockQuery.php b/src/applications/pholio/query/PholioMockQuery.php
--- a/src/applications/pholio/query/PholioMockQuery.php
+++ b/src/applications/pholio/query/PholioMockQuery.php
@@ -9,6 +9,7 @@
private $ids;
private $phids;
private $authorPHIDs;
+ private $projectPHIDs;
private $statuses;
private $needCoverFiles;
@@ -31,6 +32,11 @@
return $this;
}
+ public function withProjectPHIDs(array $project_phids) {
+ $this->projectPHIDs = $project_phids;
+ return $this;
+ }
+
public function withStatuses(array $statuses) {
$this->statuses = $statuses;
return $this;
@@ -62,8 +68,9 @@
$data = queryfx_all(
$conn_r,
- 'SELECT * FROM %T %Q %Q %Q',
+ 'SELECT * FROM %T r %Q %Q %Q %Q',
$table->getTableName(),
+ $this->buildJoinsClause($conn_r),
$this->buildWhereClause($conn_r),
$this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r));
@@ -85,6 +92,21 @@
return $mocks;
}
+ private function buildJoinsClause ($conn_r) {
+ $joins = array();
+
+ if ($this->projectPHIDs) {
+ $joins[] = qsprintf(
+ $conn_r,
+ 'JOIN edge e ON e.src = r.phid');
+ }
+ $joins = implode(' ', $joins);
+
+ return $joins;
+ }
+
+
+
private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$where = array();
@@ -111,6 +133,13 @@
$this->authorPHIDs);
}
+ if ($this->projectPHIDs) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'e.dst in (%Ls)',
+ $this->projectPHIDs);
+ }
+
if ($this->statuses) {
$where[] = qsprintf(
$conn_r,
diff --git a/src/applications/pholio/query/PholioMockSearchEngine.php b/src/applications/pholio/query/PholioMockSearchEngine.php
--- a/src/applications/pholio/query/PholioMockSearchEngine.php
+++ b/src/applications/pholio/query/PholioMockSearchEngine.php
@@ -17,6 +17,9 @@
'authorPHIDs',
$this->readUsersFromRequest($request, 'authors'));
$saved->setParameter(
+ 'projectPHIDs',
+ $this->readPHIDsFromRequest($request, 'projects'));
+ $saved->setParameter(
'statuses',
$request->getStrList('status'));
@@ -29,6 +32,7 @@
->needImages(true)
->needTokenCounts(true)
->withAuthorPHIDs($saved->getParameter('authorPHIDs', array()))
+ ->withProjectPHIDs($saved->getParameter('projectPHIDs', array()))
->withStatuses($saved->getParameter('statuses', array()));
return $query;
@@ -44,6 +48,12 @@
->withPHIDs($phids)
->execute();
+ $project_phids = $saved_query->getParameter('projectPHIDs', array());
+ $project_names = id(new PhabricatorHandleQuery())
+ ->setViewer($this->requireViewer())
+ ->withPHIDs($project_phids)
+ ->execute();
+
$statuses = array(
'' => pht('Any Status'),
'closed' => pht('Closed'),
@@ -60,6 +70,12 @@
->setLabel(pht('Authors'))
->setValue($author_handles))
->appendChild(
+ id(new AphrontFormTokenizerControl())
+ ->setDatasource('/typeahead/common/projects/')
+ ->setName('projects')
+ ->setLabel(pht('Projects'))
+ ->setValue($project_names))
+ ->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Status'))
->setName('status')
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 12:18 AM (6 d, 10 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7637895
Default Alt Text
D9724.diff (3 KB)
Attached To
Mode
D9724: Allow searching pholio mocks by project
Attached
Detach File
Event Timeline
Log In to Comment