mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +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:
parent
e55522cade
commit
5f957807a7
1 changed files with 16 additions and 26 deletions
|
@ -11,40 +11,30 @@ final class PhabricatorOAuthServerClientSearchEngine
|
|||
return 'PhabricatorOAuthServerApplication';
|
||||
}
|
||||
|
||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||
$saved = new PhabricatorSavedQuery();
|
||||
|
||||
$saved->setParameter(
|
||||
'creatorPHIDs',
|
||||
$this->readUsersFromRequest($request, 'creators'));
|
||||
|
||||
return $saved;
|
||||
public function newQuery() {
|
||||
return id(new PhabricatorOAuthServerClientQuery());
|
||||
}
|
||||
|
||||
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
|
||||
$query = id(new PhabricatorOAuthServerClientQuery());
|
||||
protected function buildQueryFromParameters(array $map) {
|
||||
$query = $this->newQuery();
|
||||
|
||||
$creator_phids = $saved->getParameter('creatorPHIDs', array());
|
||||
if ($creator_phids) {
|
||||
$query->withCreatorPHIDs($saved->getParameter('creatorPHIDs', array()));
|
||||
if ($map['creatorPHIDs']) {
|
||||
$query->withCreatorPHIDs($map['creatorPHIDs']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function buildSearchForm(
|
||||
AphrontFormView $form,
|
||||
PhabricatorSavedQuery $saved_query) {
|
||||
|
||||
$creator_phids = $saved_query->getParameter('creatorPHIDs', array());
|
||||
|
||||
$form
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setDatasource(new PhabricatorPeopleDatasource())
|
||||
->setName('creators')
|
||||
->setLabel(pht('Creators'))
|
||||
->setValue($creator_phids));
|
||||
protected function buildCustomSearchFields() {
|
||||
return array(
|
||||
id(new PhabricatorUsersSearchField())
|
||||
->setAliases(array('creators'))
|
||||
->setKey('creatorPHIDs')
|
||||
->setConduitKey('creators')
|
||||
->setLabel(pht('Creators'))
|
||||
->setDescription(
|
||||
pht('Search for applications created by particular users.')),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getURI($path) {
|
||||
|
|
Loading…
Reference in a new issue