diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php index 7b92e7f7d1..e3aa8075fb 100644 --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -718,22 +718,25 @@ final class ManiphestTaskQuery break; } + $joins[] = $this->buildApplicationSearchJoinClause($conn_r); + return implode(' ', $joins); } private function buildGroupClause(AphrontDatabaseConnection $conn_r) { - $joined_multiple_project_rows = (count($this->projectPHIDs) > 1) || - (count($this->anyProjectPHIDs) > 1); + $joined_multiple_rows = (count($this->projectPHIDs) > 1) || + (count($this->anyProjectPHIDs) > 1) || + ($this->getApplicationSearchMayJoinMultipleRows()); $joined_project_name = ($this->groupBy == self::GROUP_PROJECT); // If we're joining multiple rows, we need to group the results by the // task IDs. - if ($joined_multiple_project_rows) { + if ($joined_multiple_rows) { if ($joined_project_name) { - return 'GROUP BY task.id, projectGroup.projectPHID'; + return 'GROUP BY task.phid, projectGroup.projectPHID'; } else { - return 'GROUP BY task.id'; + return 'GROUP BY task.phid'; } } else { return ''; @@ -950,4 +953,8 @@ final class ManiphestTaskQuery )); } + protected function getApplicationSearchObjectPHIDColumn() { + return 'task.phid'; + } + } diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php index e2a5ed795f..3adfc8d7be 100644 --- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php +++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php @@ -3,6 +3,10 @@ final class ManiphestTaskSearchEngine extends PhabricatorApplicationSearchEngine { + public function getCustomFieldObject() { + return new ManiphestTask(); + } + public function buildSavedQueryFromRequest(AphrontRequest $request) { $saved = new PhabricatorSavedQuery(); @@ -62,6 +66,8 @@ final class ManiphestTaskSearchEngine $saved->setParameter('limit', $limit); } + $this->readCustomFieldsFromRequest($request, $saved); + return $saved; } @@ -155,6 +161,8 @@ final class ManiphestTaskSearchEngine $query->withDateCreatedBefore($end); } + $this->applyCustomFieldsToQuery($query, $saved); + return $query; } @@ -308,6 +316,8 @@ final class ManiphestTaskSearchEngine ->setLabel(pht('Task IDs')) ->setValue(implode(', ', $ids))); + $this->appendCustomFieldsToForm($form, $saved); + $this->buildDateRange( $form, $saved, diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php index 0fafe6c484..3bdfdb1a4c 100644 --- a/src/applications/people/query/PhabricatorPeopleQuery.php +++ b/src/applications/people/query/PhabricatorPeopleQuery.php @@ -266,6 +266,8 @@ final class PhabricatorPeopleQuery $this->nameLike); } + $where[] = $this->buildPagingClause($conn_r); + return $this->formatWhereClause($where); }