1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Added application name to the typeahead results for doc type search

Summary: Ref T10951. This adds the application name as an attribute below the document type in the UI for doc type search.

Test Plan: Verify that the application name appears as an attribute on the document type results.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T10951

Differential Revision: https://secure.phabricator.com/D16446
This commit is contained in:
Josh Cox 2016-08-24 18:11:15 -04:00
parent 7f7c3acfac
commit d135b3f2d5

View file

@ -30,17 +30,25 @@ final class PhabricatorSearchDocumentTypeDatasource
PhabricatorSearchApplicationSearchEngine::getIndexableDocumentTypes(
$viewer);
$icons = mpull(
PhabricatorPHIDType::getAllTypes(),
'getTypeIcon',
$phid_types = mpull(PhabricatorPHIDType::getAllTypes(),
null,
'getTypeConstant');
$results = array();
foreach ($types as $type => $name) {
$type_object = idx($phid_types, $type);
if (!$type_object) {
continue;
}
$application_class = $type_object->getPHIDTypeApplicationClass();
$application = PhabricatorApplication::getByClass($application_class);
$application_name = $application->getName();
$results[$type] = id(new PhabricatorTypeaheadResult())
->setPHID($type)
->setName($name)
->setIcon(idx($icons, $type));
->addAttribute($application_name)
->setIcon($type_object->getTypeIcon());
}
return $results;