Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14749764
D9324.id.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
D9324.id.diff
View Options
diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php
--- a/src/applications/maniphest/query/ManiphestTaskQuery.php
+++ b/src/applications/maniphest/query/ManiphestTaskQuery.php
@@ -11,6 +11,7 @@
private $taskIDs = array();
private $taskPHIDs = array();
+ private $dependentTaskIDs = array();
private $authorPHIDs = array();
private $ownerPHIDs = array();
private $includeUnowned = null;
@@ -70,6 +71,11 @@
return $this;
}
+ public function withDependentIDs(array $ids) {
+ $this->dependentTaskIDs = $ids;
+ return $this;
+ }
+
public function withOwners(array $owners) {
$this->includeUnowned = false;
foreach ($owners as $k => $phid) {
@@ -195,6 +201,7 @@
$where = array();
$where[] = $this->buildTaskIDsWhereClause($conn);
$where[] = $this->buildTaskPHIDsWhereClause($conn);
+ $where[] = $this->buildDependentTaskIDsWhereClause($conn);
$where[] = $this->buildStatusWhereClause($conn);
$where[] = $this->buildStatusesWhereClause($conn);
$where[] = $this->buildPrioritiesWhereClause($conn);
@@ -357,6 +364,26 @@
$this->taskPHIDs);
}
+ private function buildDependentTaskIDsWhereClause(
+ AphrontDatabaseConnection $conn) {
+ if (!$this->dependentTaskIDs) {
+ return null;
+ }
+
+ $dependent_tasks = id(new ManiphestTaskQuery())
+ ->setViewer($this->getViewer())
+ ->withIDs($this->dependentTaskIDs)
+ ->execute();
+
+ $dependent_task_phids = mpull($dependent_tasks, 'getPHID');
+
+ return qsprintf(
+ $conn,
+ 'edge.type = %s AND edge.dst IN (%Ls)',
+ PhabricatorEdgeConfig::TYPE_TASK_DEPENDED_ON_BY_TASK,
+ $dependent_task_phids);
+ }
+
private function buildStatusWhereClause(AphrontDatabaseConnection $conn) {
static $map = array(
@@ -646,6 +673,12 @@
$joins = array();
+ if ($this->dependentTaskIDs) {
+ $joins[] = qsprintf(
+ $conn_r,
+ 'JOIN edge ON edge.src = task.phid');
+ }
+
if ($this->projectPHIDs || $this->includeNoProject) {
$joins[] = qsprintf(
$conn_r,
diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
--- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
+++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
@@ -77,6 +77,17 @@
}
$saved->setParameter('ids', $ids);
+ $dependent_ids = $request->getStrList('dependentIds');
+ foreach ($dependent_ids as $key => $id) {
+ $id = trim($id, ' Tt');
+ if (!$id || !is_numeric($id)) {
+ unset($ids[$key]);
+ } else {
+ $dependent_ids[$key] = $id;
+ }
+ }
+ $saved->setParameter('dependentIds', $dependent_ids);
+
$saved->setParameter('fulltext', $request->getStr('fulltext'));
$saved->setParameter(
@@ -168,6 +179,11 @@
$query->withIDs($ids);
}
+ $dependent_ids = $saved->getParameter('dependentIds');
+ if ($dependent_ids) {
+ $query->withDependentIDs($dependent_ids);
+ }
+
$fulltext = $saved->getParameter('fulltext');
if (strlen($fulltext)) {
$query->withFullTextSearch($fulltext);
@@ -301,6 +317,7 @@
}
$ids = $saved->getParameter('ids', array());
+ $dependent_ids = $saved->getParameter('dependentIds', array());
$form
->appendChild(
@@ -394,7 +411,12 @@
id(new AphrontFormTextControl())
->setName('ids')
->setLabel(pht('Task IDs'))
- ->setValue(implode(', ', $ids)));
+ ->setValue(implode(', ', $ids)))
+ ->appendChild(
+ id(new AphrontFormTextControl())
+ ->setName('dependentIds')
+ ->setLabel(pht('Dependent Task IDs'))
+ ->setValue(implode(', ', $dependent_ids)));
$this->appendCustomFieldsToForm($form, $saved);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 11:34 AM (8 h, 2 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7031973
Default Alt Text
D9324.id.diff (3 KB)
Attached To
Mode
D9324: Add support for Dependent Tasks filter in Maniphest search queries
Attached
Detach File
Event Timeline
Log In to Comment