@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+30 -2
+19 -2
src/applications/project/query/PhabricatorProjectSearchEngine.php
··· 13 13 14 14 public function newQuery() { 15 15 return id(new PhabricatorProjectQuery()) 16 - ->needImages(true) 17 - ->withIsMilestone(false); 16 + ->needImages(true); 18 17 } 19 18 20 19 protected function buildCustomSearchFields() { ··· 34 33 ->setLabel(pht('Status')) 35 34 ->setKey('status') 36 35 ->setOptions($this->getStatusOptions()), 36 + id(new PhabricatorSearchThreeStateField()) 37 + ->setLabel(pht('Milestones')) 38 + ->setKey('isMilestone') 39 + ->setOptions( 40 + pht('(Show All)'), 41 + pht('Show Only Milestones'), 42 + pht('Hide Milestones')) 43 + ->setDescription( 44 + pht( 45 + 'Pass true to find only milestones, or false to omit '. 46 + 'milestones.')), 37 47 id(new PhabricatorSearchCheckboxesField()) 38 48 ->setLabel(pht('Icons')) 39 49 ->setKey('icons') ··· 77 87 $query->withColors($map['colors']); 78 88 } 79 89 90 + if ($map['isMilestone'] !== null) { 91 + $query->withIsMilestone($map['isMilestone']); 92 + } 93 + 80 94 return $query; 81 95 } 82 96 ··· 102 116 $query->setQueryKey($query_key); 103 117 104 118 $viewer_phid = $this->requireViewer()->getPHID(); 119 + 120 + // By default, do not show milestones in the list view. 121 + $query->setParameter('isMilestone', false); 105 122 106 123 switch ($query_key) { 107 124 case 'all':
+11
src/applications/project/storage/PhabricatorProject.php
··· 742 742 ->setType('string') 743 743 ->setDescription(pht('Primary slug/hashtag.')), 744 744 id(new PhabricatorConduitSearchFieldSpecification()) 745 + ->setKey('milestone') 746 + ->setType('int?') 747 + ->setDescription(pht('For milestones, milestone sequence number.')), 748 + id(new PhabricatorConduitSearchFieldSpecification()) 745 749 ->setKey('icon') 746 750 ->setType('map<string, wild>') 747 751 ->setDescription(pht('Information about the project icon.')), ··· 756 760 $color_key = $this->getColor(); 757 761 $color_name = PhabricatorProjectIconSet::getColorName($color_key); 758 762 763 + if ($this->isMilestone()) { 764 + $milestone = (int)$this->getMilestoneNumber(); 765 + } else { 766 + $milestone = null; 767 + } 768 + 759 769 return array( 760 770 'name' => $this->getName(), 761 771 'slug' => $this->getPrimarySlug(), 772 + 'milestone' => $milestone, 762 773 'icon' => array( 763 774 'key' => $this->getDisplayIconKey(), 764 775 'name' => $this->getDisplayIconName(),