@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.

Don't show un-completeable results in people/project autocomplete

Summary:
Fixes T10285.

- If a result (like a milestone) has no primary hashtag, try to fill in a secondary hashtag.
- If we can't find any hashtag, don't return the result.

This produces these behaviors:

- By default, you can't autocomplete milestones.
- If you give one a hashtag, you can.

We might want to give milestones "special" hashtags eventually (like `#xyz/33`) but this fixes the confusing/broken behavior in the UI and we can wait for a better use case for letting you autocomplete milestones, I think.

Also, don't try to cycle hashtags when renaming milestones. This was a little inconsistent before.

Test Plan:
- Autocompleted normal projects.
- Autocompleted milestones with explicit hashtags.
- No autocomplete entry for milestones with no special hashtags.
- Used normal typeahead to get tag-less milestones to make sure I didn't break anything.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10285

Differential Revision: https://secure.phabricator.com/D15261

+29 -6
+5 -4
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
··· 169 169 case PhabricatorProjectTransaction::TYPE_NAME: 170 170 // First, add the old name as a secondary slug; this is helpful 171 171 // for renames and generally a good thing to do. 172 - if ($old !== null) { 173 - $this->addSlug($object, $old, false); 172 + if (!$this->getIsMilestone()) { 173 + if ($old !== null) { 174 + $this->addSlug($object, $old, false); 175 + } 176 + $this->addSlug($object, $new, false); 174 177 } 175 - $this->addSlug($object, $new, false); 176 - 177 178 return; 178 179 case PhabricatorProjectTransaction::TYPE_SLUGS: 179 180 $old = $xaction->getOldValue();
+19 -1
src/applications/project/typeahead/PhabricatorProjectDatasource.php
··· 38 38 $query->withIsMilestone(false); 39 39 } 40 40 41 + $for_autocomplete = $this->getParameter('autocomplete'); 42 + 41 43 $projs = $this->executeQuery($query); 42 44 43 45 $projs = mpull($projs, null, 'getPHID'); ··· 58 60 if (!isset($has_cols[$proj->getPHID()])) { 59 61 continue; 60 62 } 63 + 64 + $slug = $proj->getPrimarySlug(); 65 + if (!strlen($slug)) { 66 + foreach ($proj->getSlugs() as $slug_object) { 67 + $slug = $slug_object->getSlug(); 68 + if (strlen($slug)) { 69 + break; 70 + } 71 + } 72 + } 73 + 74 + // If we're building results for the autocompleter and this project 75 + // doesn't have any usable slugs, don't return it as a result. 76 + if ($for_autocomplete && !strlen($slug)) { 77 + continue; 78 + } 79 + 61 80 $closed = null; 62 81 if ($proj->isArchived()) { 63 82 $closed = pht('Archived'); ··· 78 97 ->setPriorityType('proj') 79 98 ->setClosed($closed); 80 99 81 - $slug = $proj->getPrimarySlug(); 82 100 if (strlen($slug)) { 83 101 $proj_result->setAutocomplete('#'.$slug); 84 102 }
+5 -1
src/view/form/control/PhabricatorRemarkupControl.php
··· 45 45 $root_id = celerity_generate_unique_node_id(); 46 46 47 47 $user_datasource = new PhabricatorPeopleDatasource(); 48 - $proj_datasource = new PhabricatorProjectDatasource(); 48 + $proj_datasource = id(new PhabricatorProjectDatasource()) 49 + ->setParameters( 50 + array( 51 + 'autocomplete' => 1, 52 + )); 49 53 50 54 Javelin::initBehavior( 51 55 'phabricator-remarkup-assist',