diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index 1d234d4285..b09ad9cb22 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -585,6 +585,18 @@ final class PhabricatorProject extends PhabricatorProjectDAO return $name; } + public function getDisplayNameWithAncestorPath() { + // Figure out the ancestors for this project + // so that we can prepend that to the display name. + $ancestors = mpull(array_reverse($this->getAncestorProjects()), 'getName'); + $ancestors[] = $this->getName(); + + $project_name_with_path = implode(' > ', $ancestors); + + // no pht usage, since we don't have translatable items. + return $project_name_with_path; + } + public function getDisplayIconKey() { if ($this->isMilestone()) { $key = PhabricatorProjectIconSet::getMilestoneIconKey(); diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php index e0354be698..c663a4a334 100644 --- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php +++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php @@ -105,18 +105,6 @@ final class PhabricatorProjectDatasource $all_strings = array(); - // Figure out the ancestors for this project - // so that we can prepend that to the display name. - $ancestors = array_reverse($proj->getAncestorProjects()); - $ancestor_strings = array(); - foreach ($ancestors as $ancestor) { - $ancestor_strings[] = $ancestor->getName(); - } - $ancestor_strings = implode(' > ', $ancestor_strings); - if (strlen($ancestor_strings) > 0) { - $ancestor_strings = $ancestor_strings.' > '; - } - // NOTE: We list the project's name first because results will be // sorted into prefix vs content phases incorrectly if we don't: it // will look like "Parent (Milestone)" matched "Parent" as a prefix, @@ -135,7 +123,7 @@ final class PhabricatorProjectDatasource $proj_result = id(new PhabricatorTypeaheadResult()) ->setName($all_strings) - ->setDisplayName($ancestor_strings.$proj->getDisplayName()) + ->setDisplayName($proj->getDisplayNameWithAncestorPath()) ->setDisplayType($proj->getDisplayIconName()) ->setURI($proj->getURI()) ->setPHID($phid)