Differential D12444 Diff 29861 src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | if (isset($sources[$class])) { | ||||
$composite->addDatasource($source); | $composite->addDatasource($source); | ||||
$composite | $composite | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setQuery($query) | ->setQuery($query) | ||||
->setRawQuery($raw_query); | ->setRawQuery($raw_query); | ||||
$hard_limit = 1000; | $hard_limit = 1000; | ||||
$limit = 100; | |||||
if ($is_browse) { | if ($is_browse) { | ||||
if (!$composite->isBrowsable()) { | if (!$composite->isBrowsable()) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$limit = 10; | |||||
if (($offset + $limit) >= $hard_limit) { | if (($offset + $limit) >= $hard_limit) { | ||||
// Offset-based paging is intrinsically slow; hard-cap how far we're | // Offset-based paging is intrinsically slow; hard-cap how far we're | ||||
// willing to go with it. | // willing to go with it. | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$composite | $composite | ||||
->setLimit($limit + 1) | ->setLimit($limit + 1) | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | if (isset($sources[$class])) { | ||||
$select = array( | $select = array( | ||||
'offset' => $offset, | 'offset' => $offset, | ||||
'q' => $query, | 'q' => $query, | ||||
); | ); | ||||
$items = array(); | $items = array(); | ||||
foreach ($results as $result) { | foreach ($results as $result) { | ||||
$token = PhabricatorTypeaheadTokenView::newForTypeaheadResult( | $token = PhabricatorTypeaheadTokenView::newFromTypeaheadResult( | ||||
$result); | $result); | ||||
// Disable already-selected tokens. | // Disable already-selected tokens. | ||||
$disabled = isset($exclude[$result->getPHID()]); | $disabled = isset($exclude[$result->getPHID()]); | ||||
$value = $select + array('phid' => $result->getPHID()); | $value = $select + array('phid' => $result->getPHID()); | ||||
$value = json_encode($value); | $value = json_encode($value); | ||||
▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines |