mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
Provide ApplicationSearch hooks in Maniphest
Summary: Ref T418. Adds hooks to support customized ApplicationSearch (you can't currently add indexable fields without writing custom code). Test Plan: Wrote custom code to add an indexable field. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T418 Differential Revision: https://secure.phabricator.com/D7002
This commit is contained in:
parent
dd4537edef
commit
ed126cd47e
3 changed files with 24 additions and 5 deletions
|
@ -718,22 +718,25 @@ final class ManiphestTaskQuery
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$joins[] = $this->buildApplicationSearchJoinClause($conn_r);
|
||||||
|
|
||||||
return implode(' ', $joins);
|
return implode(' ', $joins);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
private function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
||||||
$joined_multiple_project_rows = (count($this->projectPHIDs) > 1) ||
|
$joined_multiple_rows = (count($this->projectPHIDs) > 1) ||
|
||||||
(count($this->anyProjectPHIDs) > 1);
|
(count($this->anyProjectPHIDs) > 1) ||
|
||||||
|
($this->getApplicationSearchMayJoinMultipleRows());
|
||||||
|
|
||||||
$joined_project_name = ($this->groupBy == self::GROUP_PROJECT);
|
$joined_project_name = ($this->groupBy == self::GROUP_PROJECT);
|
||||||
|
|
||||||
// If we're joining multiple rows, we need to group the results by the
|
// If we're joining multiple rows, we need to group the results by the
|
||||||
// task IDs.
|
// task IDs.
|
||||||
if ($joined_multiple_project_rows) {
|
if ($joined_multiple_rows) {
|
||||||
if ($joined_project_name) {
|
if ($joined_project_name) {
|
||||||
return 'GROUP BY task.id, projectGroup.projectPHID';
|
return 'GROUP BY task.phid, projectGroup.projectPHID';
|
||||||
} else {
|
} else {
|
||||||
return 'GROUP BY task.id';
|
return 'GROUP BY task.phid';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
|
@ -950,4 +953,8 @@ final class ManiphestTaskQuery
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getApplicationSearchObjectPHIDColumn() {
|
||||||
|
return 'task.phid';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class ManiphestTaskSearchEngine
|
final class ManiphestTaskSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getCustomFieldObject() {
|
||||||
|
return new ManiphestTask();
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -62,6 +66,8 @@ final class ManiphestTaskSearchEngine
|
||||||
$saved->setParameter('limit', $limit);
|
$saved->setParameter('limit', $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->readCustomFieldsFromRequest($request, $saved);
|
||||||
|
|
||||||
return $saved;
|
return $saved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +161,8 @@ final class ManiphestTaskSearchEngine
|
||||||
$query->withDateCreatedBefore($end);
|
$query->withDateCreatedBefore($end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->applyCustomFieldsToQuery($query, $saved);
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,6 +316,8 @@ final class ManiphestTaskSearchEngine
|
||||||
->setLabel(pht('Task IDs'))
|
->setLabel(pht('Task IDs'))
|
||||||
->setValue(implode(', ', $ids)));
|
->setValue(implode(', ', $ids)));
|
||||||
|
|
||||||
|
$this->appendCustomFieldsToForm($form, $saved);
|
||||||
|
|
||||||
$this->buildDateRange(
|
$this->buildDateRange(
|
||||||
$form,
|
$form,
|
||||||
$saved,
|
$saved,
|
||||||
|
|
|
@ -266,6 +266,8 @@ final class PhabricatorPeopleQuery
|
||||||
$this->nameLike);
|
$this->nameLike);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$where[] = $this->buildPagingClause($conn_r);
|
||||||
|
|
||||||
return $this->formatWhereClause($where);
|
return $this->formatWhereClause($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue