Skip to content

Commit 727a7de

Browse files
author
epriestley
committedMay 26, 2016
Sort project typeahead tokens by display name, not hashtag
Summary: Fixes T8510. Results are internally ordered by "name", which is the full list of strings a user can type to match a result. On the balance, it is probably good/correct to order by this (particularly, it allows `function(x)` to sort near `x`). However, the way projects were built put the tags first, so a project like "Discovery" could end up last if it had originally been created with a different name like "Search Team", so that its first slug is "search-team". Instead, put the display name first in the ordering. Test Plan: {F1661775} To reproduce in particular: - Create a project named "Zebra". - Create a lot of projects named "Armadillo-blahblahblah". - Rename "Zebra" to "Armadillo". Before the patch, the new "Armadillo" project would still sort as though it were named "Zebra". After the patch, it sorts as expected normally. Reviewers: chad Reviewed By: chad Maniphest Tasks: T8510 Differential Revision: https://secure.phabricator.com/D15981
1 parent 5b77b86 commit 727a7de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎src/applications/project/typeahead/PhabricatorProjectDatasource.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ public function loadResults() {
8282
$closed = pht('Archived');
8383
}
8484

85-
$all_strings = mpull($proj->getSlugs(), 'getSlug');
85+
$all_strings = array();
8686
$all_strings[] = $proj->getDisplayName();
87+
foreach ($proj->getSlugs() as $project_slug) {
88+
$all_strings[] = $project_slug->getSlug();
89+
}
8790
$all_strings = implode(' ', $all_strings);
8891

8992
$proj_result = id(new PhabricatorTypeaheadResult())

0 commit comments

Comments
 (0)
Failed to load comments.