Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/query/PholioMockSearchEngine.php
Show All 28 Lines | final class PholioMockSearchEngine extends PhabricatorApplicationSearchEngine { | ||||
} | } | ||||
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { | public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { | ||||
$query = id(new PholioMockQuery()) | $query = id(new PholioMockQuery()) | ||||
->needCoverFiles(true) | ->needCoverFiles(true) | ||||
->needImages(true) | ->needImages(true) | ||||
->needTokenCounts(true); | ->needTokenCounts(true); | ||||
$datasource = id(new PhabricatorTypeaheadUserParameterizedDatasource()) | $datasource = id(new PhabricatorPeopleUserFunctionDatasource()) | ||||
->setViewer($this->requireViewer()); | ->setViewer($this->requireViewer()); | ||||
$author_phids = $saved->getParameter('authorPHIDs', array()); | $author_phids = $saved->getParameter('authorPHIDs', array()); | ||||
$author_phids = $datasource->evaluateTokens($author_phids); | $author_phids = $datasource->evaluateTokens($author_phids); | ||||
if ($author_phids) { | if ($author_phids) { | ||||
$query->withAuthorPHIDs($author_phids); | $query->withAuthorPHIDs($author_phids); | ||||
} | } | ||||
Show All 21 Lines | public function buildSearchForm( | ||||
); | ); | ||||
$status = $saved_query->getParameter('statuses', array()); | $status = $saved_query->getParameter('statuses', array()); | ||||
$status = head($status); | $status = head($status); | ||||
$form | $form | ||||
->appendControl( | ->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setDatasource(new PhabricatorTypeaheadUserParameterizedDatasource()) | ->setDatasource(new PhabricatorPeopleUserFunctionDatasource()) | ||||
->setName('authors') | ->setName('authors') | ||||
->setLabel(pht('Authors')) | ->setLabel(pht('Authors')) | ||||
->setValue($author_phids)) | ->setValue($author_phids)) | ||||
->appendControl( | ->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setDatasource(new PhabricatorProjectLogicalDatasource()) | ->setDatasource(new PhabricatorProjectLogicalDatasource()) | ||||
->setName('projects') | ->setName('projects') | ||||
->setLabel(pht('Projects')) | ->setLabel(pht('Projects')) | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |