mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-03 03:11:01 +01:00
Return milestone information in project.search
Summary: Ref T12074. - `project.search` now returns milestones by default. - A new constraint, `isMilestone`, allows filtering to milestones, non-milestones, or both (API and web UI). - `project.search` now returns a milestone number for milestones, or `null` for non-milestones. NOTE: Existing custom saved queries in projects which previously did not return milestones now will. I expect this to have little-to-no impact on users, and these queries are easy to correct, but I'll note this in changelogs. Test Plan: - Ran various queries with `project.search` and in the web UI, searching for milestones, non-milestones, and both. - Web UI default behavior (no milestones) is unchanged, but you can now get milestones if you want them. - Queried a milestone by ID/PHID via API. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12074 Differential Revision: https://secure.phabricator.com/D17153
This commit is contained in:
parent
f16778fc18
commit
e03103f349
2 changed files with 30 additions and 2 deletions
|
@ -13,8 +13,7 @@ final class PhabricatorProjectSearchEngine
|
||||||
|
|
||||||
public function newQuery() {
|
public function newQuery() {
|
||||||
return id(new PhabricatorProjectQuery())
|
return id(new PhabricatorProjectQuery())
|
||||||
->needImages(true)
|
->needImages(true);
|
||||||
->withIsMilestone(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildCustomSearchFields() {
|
protected function buildCustomSearchFields() {
|
||||||
|
@ -34,6 +33,17 @@ final class PhabricatorProjectSearchEngine
|
||||||
->setLabel(pht('Status'))
|
->setLabel(pht('Status'))
|
||||||
->setKey('status')
|
->setKey('status')
|
||||||
->setOptions($this->getStatusOptions()),
|
->setOptions($this->getStatusOptions()),
|
||||||
|
id(new PhabricatorSearchThreeStateField())
|
||||||
|
->setLabel(pht('Milestones'))
|
||||||
|
->setKey('isMilestone')
|
||||||
|
->setOptions(
|
||||||
|
pht('(Show All)'),
|
||||||
|
pht('Show Only Milestones'),
|
||||||
|
pht('Hide Milestones'))
|
||||||
|
->setDescription(
|
||||||
|
pht(
|
||||||
|
'Pass true to find only milestones, or false to omit '.
|
||||||
|
'milestones.')),
|
||||||
id(new PhabricatorSearchCheckboxesField())
|
id(new PhabricatorSearchCheckboxesField())
|
||||||
->setLabel(pht('Icons'))
|
->setLabel(pht('Icons'))
|
||||||
->setKey('icons')
|
->setKey('icons')
|
||||||
|
@ -77,6 +87,10 @@ final class PhabricatorProjectSearchEngine
|
||||||
$query->withColors($map['colors']);
|
$query->withColors($map['colors']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($map['isMilestone'] !== null) {
|
||||||
|
$query->withIsMilestone($map['isMilestone']);
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +117,9 @@ final class PhabricatorProjectSearchEngine
|
||||||
|
|
||||||
$viewer_phid = $this->requireViewer()->getPHID();
|
$viewer_phid = $this->requireViewer()->getPHID();
|
||||||
|
|
||||||
|
// By default, do not show milestones in the list view.
|
||||||
|
$query->setParameter('isMilestone', false);
|
||||||
|
|
||||||
switch ($query_key) {
|
switch ($query_key) {
|
||||||
case 'all':
|
case 'all':
|
||||||
return $query;
|
return $query;
|
||||||
|
|
|
@ -741,6 +741,10 @@ final class PhabricatorProject extends PhabricatorProjectDAO
|
||||||
->setKey('slug')
|
->setKey('slug')
|
||||||
->setType('string')
|
->setType('string')
|
||||||
->setDescription(pht('Primary slug/hashtag.')),
|
->setDescription(pht('Primary slug/hashtag.')),
|
||||||
|
id(new PhabricatorConduitSearchFieldSpecification())
|
||||||
|
->setKey('milestone')
|
||||||
|
->setType('int?')
|
||||||
|
->setDescription(pht('For milestones, milestone sequence number.')),
|
||||||
id(new PhabricatorConduitSearchFieldSpecification())
|
id(new PhabricatorConduitSearchFieldSpecification())
|
||||||
->setKey('icon')
|
->setKey('icon')
|
||||||
->setType('map<string, wild>')
|
->setType('map<string, wild>')
|
||||||
|
@ -756,9 +760,16 @@ final class PhabricatorProject extends PhabricatorProjectDAO
|
||||||
$color_key = $this->getColor();
|
$color_key = $this->getColor();
|
||||||
$color_name = PhabricatorProjectIconSet::getColorName($color_key);
|
$color_name = PhabricatorProjectIconSet::getColorName($color_key);
|
||||||
|
|
||||||
|
if ($this->isMilestone()) {
|
||||||
|
$milestone = (int)$this->getMilestoneNumber();
|
||||||
|
} else {
|
||||||
|
$milestone = null;
|
||||||
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'name' => $this->getName(),
|
'name' => $this->getName(),
|
||||||
'slug' => $this->getPrimarySlug(),
|
'slug' => $this->getPrimarySlug(),
|
||||||
|
'milestone' => $milestone,
|
||||||
'icon' => array(
|
'icon' => array(
|
||||||
'key' => $this->getDisplayIconKey(),
|
'key' => $this->getDisplayIconKey(),
|
||||||
'name' => $this->getDisplayIconName(),
|
'name' => $this->getDisplayIconName(),
|
||||||
|
|
Loading…
Reference in a new issue