Differential D9611 Diff 23072 src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
Show All 31 Lines | public function processRequest() { | ||||
$need_arcanist_projects = 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; | ||||
$need_build_plans = false; | $need_build_plans = false; | ||||
$need_task_priority = false; | $need_task_priority = false; | ||||
$need_macros = false; | $need_macros = false; | ||||
$need_legalpad_documents = false; | $need_legalpad_documents = false; | ||||
$need_workboard_columns = 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; | ||||
$need_symbols = true; | $need_symbols = true; | ||||
$need_projs = true; | $need_projs = true; | ||||
$need_jump_objects = true; | $need_jump_objects = true; | ||||
Show All 20 Lines | switch ($this->type) { | ||||
case 'projects': | case 'projects': | ||||
$need_projs = true; | $need_projs = true; | ||||
break; | break; | ||||
case 'usersorprojects': | case 'usersorprojects': | ||||
case 'accountsorprojects': | case 'accountsorprojects': | ||||
$need_users = true; | $need_users = true; | ||||
$need_projs = true; | $need_projs = true; | ||||
break; | break; | ||||
case 'usersprojectsorpackages': | case 'usersprojectsorpackages': | ||||
$need_users = true; | $need_users = true; | ||||
$need_projs = true; | $need_projs = true; | ||||
$need_packages = true; | $need_packages = true; | ||||
break; | break; | ||||
epriestley: e.g., this is "type a user, project or package name". | |||||
case 'repositories': | case 'repositories': | ||||
$need_repos = true; | $need_repos = true; | ||||
break; | break; | ||||
case 'packages': | case 'packages': | ||||
$need_packages = true; | $need_packages = true; | ||||
break; | break; | ||||
case 'arcanistprojects': | case 'arcanistprojects': | ||||
$need_arcanist_projects = true; | $need_arcanist_projects = true; | ||||
break; | break; | ||||
case 'buildplans': | case 'buildplans': | ||||
$need_build_plans = true; | $need_build_plans = true; | ||||
break; | break; | ||||
case 'taskpriority': | case 'taskpriority': | ||||
$need_task_priority = true; | $need_task_priority = true; | ||||
break; | break; | ||||
case 'macros': | case 'macros': | ||||
$need_macros = true; | $need_macros = true; | ||||
break; | break; | ||||
case 'legalpaddocuments': | case 'legalpaddocuments': | ||||
$need_legalpad_documents = true; | $need_legalpad_documents = true; | ||||
break; | break; | ||||
case 'workboardcolumns': | |||||
$need_workboard_columns = true; | |||||
} | } | ||||
$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 284 Lines • ▼ Show 20 Lines | if ($need_jump_objects) { | ||||
->setDisplayType($handle->getTypeName()) | ->setDisplayType($handle->getTypeName()) | ||||
->setURI($handle->getURI()) | ->setURI($handle->getURI()) | ||||
->setPHID($handle->getPHID()) | ->setPHID($handle->getPHID()) | ||||
->setPriorityType('jump'); | ->setPriorityType('jump'); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if ($need_workboard_columns) { | |||||
$columns = id(new PhabricatorProjectColumnQuery()) | |||||
->setViewer($viewer) | |||||
->execute(); | |||||
if ($columns) { | |||||
foreach ($columns as $column) { | |||||
$results[] = id(new PhabricatorTypeaheadResult()) | |||||
->setName($column->getDisplayName()) | |||||
epriestleyUnsubmitted Not Done Inline ActionsThere's no great way to fix the name thing in general. You can hard-code whatever you want here, which will fix the typeahead dropdown menu. However, it won't affect tokens that are pre-filled into the input on page load, since those will use the names of their handles. There's no reasonable way to avoid this right now. You could go find that code (AphrontTokenizerTemplateView) and do something hacky there, maybe (in render(), where renderToken() is called). epriestley: There's no great way to fix the name thing in general. You can hard-code whatever you want here… | |||||
->setURI('/project/board/'.$column->getProject()->getID().'/') | |||||
->setPHID($column->getPHID()) | |||||
->setIcon('fa-columns bluegrey') | |||||
->setPriorityString($column->getProjectPHID()); | |||||
} | |||||
} | |||||
} | |||||
$content = mpull($results, 'getWireFormat'); | $content = mpull($results, 'getWireFormat'); | ||||
if ($request->isAjax()) { | if ($request->isAjax()) { | ||||
return id(new AphrontAjaxResponse())->setContent($content); | return id(new AphrontAjaxResponse())->setContent($content); | ||||
} | } | ||||
// If there's a non-Ajax request to this endpoint, show results in a tabular | // If there's a non-Ajax request to this endpoint, show results in a tabular | ||||
// format to make it easier to debug typeahead output. | // format to make it easier to debug typeahead output. | ||||
Show All 34 Lines |
e.g., this is "type a user, project or package name".