Differential D9879 Diff 23730 src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
Show All 22 Lines | public function processRequest() { | ||||
$need_users = false; | $need_users = false; | ||||
$need_agents = false; | $need_agents = false; | ||||
$need_applications = false; | $need_applications = false; | ||||
$need_lists = false; | $need_lists = false; | ||||
$need_projs = false; | $need_projs = false; | ||||
$need_packages = false; | $need_packages = false; | ||||
$need_upforgrabs = false; | $need_upforgrabs = false; | ||||
$need_arcanist_projects = false; | |||||
$need_noproject = false; | $need_noproject = false; | ||||
$need_symbols = false; | $need_symbols = false; | ||||
$need_jump_objects = false; | $need_jump_objects = false; | ||||
switch ($this->type) { | switch ($this->type) { | ||||
case 'mainsearch': | case 'mainsearch': | ||||
$need_users = true; | $need_users = true; | ||||
$need_applications = true; | $need_applications = true; | ||||
$need_rich_data = true; | $need_rich_data = true; | ||||
Show All 31 Lines | switch ($this->type) { | ||||
case 'usersprojectsorpackages': | case 'usersprojectsorpackages': | ||||
$need_users = true; | $need_users = true; | ||||
$need_projs = true; | $need_projs = true; | ||||
$need_packages = true; | $need_packages = true; | ||||
break; | break; | ||||
case 'packages': | case 'packages': | ||||
$need_packages = true; | $need_packages = true; | ||||
break; | break; | ||||
case 'arcanistprojects': | |||||
$need_arcanist_projects = true; | |||||
break; | |||||
} | } | ||||
$results = array(); | $results = array(); | ||||
if ($need_upforgrabs) { | if ($need_upforgrabs) { | ||||
$results[] = id(new PhabricatorTypeaheadResult()) | $results[] = id(new PhabricatorTypeaheadResult()) | ||||
->setName('upforgrabs (Up For Grabs)') | ->setName('upforgrabs (Up For Grabs)') | ||||
->setPHID(ManiphestTaskOwner::OWNER_UP_FOR_GRABS); | ->setPHID(ManiphestTaskOwner::OWNER_UP_FOR_GRABS); | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | if ($need_packages) { | ||||
$results[] = id(new PhabricatorTypeaheadResult()) | $results[] = id(new PhabricatorTypeaheadResult()) | ||||
->setIcon('fa-list-alt bluegrey') | ->setIcon('fa-list-alt bluegrey') | ||||
->setName($package->getName()) | ->setName($package->getName()) | ||||
->setURI('/owners/package/'.$package->getID().'/') | ->setURI('/owners/package/'.$package->getID().'/') | ||||
->setPHID($package->getPHID()); | ->setPHID($package->getPHID()); | ||||
} | } | ||||
} | } | ||||
if ($need_arcanist_projects) { | |||||
$arcprojs = id(new PhabricatorRepositoryArcanistProject())->loadAll(); | |||||
foreach ($arcprojs as $proj) { | |||||
$results[] = id(new PhabricatorTypeaheadResult()) | |||||
->setName($proj->getName()) | |||||
->setPHID($proj->getPHID()); | |||||
} | |||||
} | |||||
if ($need_applications) { | if ($need_applications) { | ||||
$applications = PhabricatorApplication::getAllInstalledApplications(); | $applications = PhabricatorApplication::getAllInstalledApplications(); | ||||
foreach ($applications as $application) { | foreach ($applications as $application) { | ||||
$uri = $application->getTypeaheadURI(); | $uri = $application->getTypeaheadURI(); | ||||
if (!$uri) { | if (!$uri) { | ||||
continue; | continue; | ||||
} | } | ||||
$name = $application->getName().' '.$application->getShortDescription(); | $name = $application->getName().' '.$application->getShortDescription(); | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |