Show ancestor path for sub-projects and milestones.

To understand better to what projects a sub-project or
milestone belongs show the entire ancestor path.

Solves part of T69306.

Differential Revision: https://developer.blender.org/D5656
This commit is contained in:
2019-09-02 07:25:33 +03:00
parent 0416648b39
commit cb29054e66

View File

@@ -105,6 +105,18 @@ 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,
@@ -123,7 +135,7 @@ final class PhabricatorProjectDatasource
$proj_result = id(new PhabricatorTypeaheadResult())
->setName($all_strings)
->setDisplayName($proj->getDisplayName())
->setDisplayName($ancestor_strings.$proj->getDisplayName())
->setDisplayType($proj->getDisplayIconName())
->setURI($proj->getURI())
->setPHID($phid)