Differential D17426 Diff 41902 src/applications/diffusion/typeahead/DiffusionTaggedRepositoriesFunctionDatasource.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/typeahead/DiffusionTaggedRepositoriesFunctionDatasource.php
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | $repositories = id(new PhabricatorRepositoryQuery()) | ||||
->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
->withEdgeLogicPHIDs( | ->withEdgeLogicPHIDs( | ||||
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, | PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, | ||||
PhabricatorQueryConstraint::OPERATOR_OR, | PhabricatorQueryConstraint::OPERATOR_OR, | ||||
$phids) | $phids) | ||||
->execute(); | ->execute(); | ||||
$results = array(); | $results = array(); | ||||
foreach ($repositories as $repository) { | foreach ($repositories as $repository) { | ||||
$results[] = $repository->getPHID(); | $results[] = $repository->getPHID(); | ||||
} | } | ||||
if (!$results) { | |||||
// TODO: This is a little hacky, but if you query for "tagged(x)" and | |||||
// there are no such repositories, we want to match nothing. If we | |||||
// just return `array()`, that gets evaluated as "no constraint" and | |||||
// we match everything. This works correctly for now, but should be | |||||
// replaced with some more elegant/general approach eventually. | |||||
$results[] = PhabricatorPHIDConstants::PHID_VOID; | |||||
} | |||||
return $results; | return $results; | ||||
} | } | ||||
public function renderFunctionTokens($function, array $argv_list) { | public function renderFunctionTokens($function, array $argv_list) { | ||||
$phids = array(); | $phids = array(); | ||||
foreach ($argv_list as $argv) { | foreach ($argv_list as $argv) { | ||||
$phids[] = head($argv); | $phids[] = head($argv); | ||||
} | } | ||||
Show All 21 Lines |