1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-25 23:10:57 +01:00

Update OAuthServer for modern SearchEngine fields

Summary: Ref T7303. Small modernization.

Test Plan:
  - Searched by various users.
  - Viewed all, reordered, etc.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7303

Differential Revision: https://secure.phabricator.com/D15606
This commit is contained in:
epriestley 2016-04-04 07:13:23 -07:00
parent e55522cade
commit 5f957807a7

View file

@ -11,40 +11,30 @@ final class PhabricatorOAuthServerClientSearchEngine
return 'PhabricatorOAuthServerApplication'; return 'PhabricatorOAuthServerApplication';
} }
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function newQuery() {
$saved = new PhabricatorSavedQuery(); return id(new PhabricatorOAuthServerClientQuery());
$saved->setParameter(
'creatorPHIDs',
$this->readUsersFromRequest($request, 'creators'));
return $saved;
} }
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { protected function buildQueryFromParameters(array $map) {
$query = id(new PhabricatorOAuthServerClientQuery()); $query = $this->newQuery();
$creator_phids = $saved->getParameter('creatorPHIDs', array()); if ($map['creatorPHIDs']) {
if ($creator_phids) { $query->withCreatorPHIDs($map['creatorPHIDs']);
$query->withCreatorPHIDs($saved->getParameter('creatorPHIDs', array()));
} }
return $query; return $query;
} }
public function buildSearchForm( protected function buildCustomSearchFields() {
AphrontFormView $form, return array(
PhabricatorSavedQuery $saved_query) { id(new PhabricatorUsersSearchField())
->setAliases(array('creators'))
$creator_phids = $saved_query->getParameter('creatorPHIDs', array()); ->setKey('creatorPHIDs')
->setConduitKey('creators')
$form
->appendControl(
id(new AphrontFormTokenizerControl())
->setDatasource(new PhabricatorPeopleDatasource())
->setName('creators')
->setLabel(pht('Creators')) ->setLabel(pht('Creators'))
->setValue($creator_phids)); ->setDescription(
pht('Search for applications created by particular users.')),
);
} }
protected function getURI($path) { protected function getURI($path) {