Commit e03103f3 authored by epriestley's avatar epriestley
Browse files

Return milestone information in

Ref T12074.

  - `` now returns milestones by default.
  - A new constraint, `isMilestone`, allows filtering to milestones, non-milestones, or both (API and web UI).
  - `` 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 `` 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:
parent f16778fc
......@@ -13,8 +13,7 @@ final class PhabricatorProjectSearchEngine
public function newQuery() {
return id(new PhabricatorProjectQuery())
protected function buildCustomSearchFields() {
......@@ -34,6 +33,17 @@ final class PhabricatorProjectSearchEngine
id(new PhabricatorSearchThreeStateField())
pht('(Show All)'),
pht('Show Only Milestones'),
pht('Hide Milestones'))
'Pass true to find only milestones, or false to omit '.
id(new PhabricatorSearchCheckboxesField())
......@@ -77,6 +87,10 @@ final class PhabricatorProjectSearchEngine
if ($map['isMilestone'] !== null) {
return $query;
......@@ -103,6 +117,9 @@ final class PhabricatorProjectSearchEngine
$viewer_phid = $this->requireViewer()->getPHID();
// By default, do not show milestones in the list view.
$query->setParameter('isMilestone', false);
switch ($query_key) {
case 'all':
return $query;
......@@ -741,6 +741,10 @@ final class PhabricatorProject extends PhabricatorProjectDAO
->setDescription(pht('Primary slug/hashtag.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setDescription(pht('For milestones, milestone sequence number.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setType('map<string, wild>')
......@@ -756,9 +760,16 @@ final class PhabricatorProject extends PhabricatorProjectDAO
$color_key = $this->getColor();
$color_name = PhabricatorProjectIconSet::getColorName($color_key);
if ($this->isMilestone()) {
$milestone = (int)$this->getMilestoneNumber();
} else {
$milestone = null;
return array(
'name' => $this->getName(),
'slug' => $this->getPrimarySlug(),
'milestone' => $milestone,
'icon' => array(
'key' => $this->getDisplayIconKey(),
'name' => $this->getDisplayIconName(),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment