1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Make owner search queries work.

Summary:

Test Plan:

Reviewers:

CC:
This commit is contained in:
epriestley 2011-02-18 17:36:25 -08:00
parent 505c82236d
commit 21650c47b6
2 changed files with 28 additions and 6 deletions

View file

@ -47,6 +47,10 @@ class PhabricatorSearchController extends PhabricatorSearchBaseController {
$query->setParameter('author', $request->getArr('author')); $query->setParameter('author', $request->getArr('author'));
} }
if ($request->getArr('owner')) {
$query->setParameter('owner', $request->getArr('owner'));
}
if ($request->getInt('open')) { if ($request->getInt('open')) {
$query->setParameter('open', $request->getInt('open')); $query->setParameter('open', $request->getInt('open'));
} }
@ -69,7 +73,8 @@ class PhabricatorSearchController extends PhabricatorSearchBaseController {
); );
$phids = array_merge( $phids = array_merge(
$query->getParameter('author', array()) $query->getParameter('author', array()),
$query->getParameter('owner', array())
); );
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = id(new PhabricatorObjectHandleData($phids))
@ -79,6 +84,11 @@ class PhabricatorSearchController extends PhabricatorSearchBaseController {
$handles, $handles,
$query->getParameter('author', array())); $query->getParameter('author', array()));
$author_value = mpull($author_value, 'getFullName', 'getPHID'); $author_value = mpull($author_value, 'getFullName', 'getPHID');
$owner_value = array_select_keys(
$handles,
$query->getParameter('owner', array()));
$owner_value = mpull($owner_value, 'getFullName', 'getPHID');
$search_form = new AphrontFormView(); $search_form = new AphrontFormView();
$search_form $search_form
@ -95,6 +105,12 @@ class PhabricatorSearchController extends PhabricatorSearchBaseController {
->setName('type') ->setName('type')
->setOptions($options) ->setOptions($options)
->setValue($query->getParameter('type'))) ->setValue($query->getParameter('type')))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel('Document Status')
->setName('open')
->setOptions($status_options)
->setValue($query->getParameter('open')))
->appendChild( ->appendChild(
id(new AphrontFormTokenizerControl()) id(new AphrontFormTokenizerControl())
->setName('author') ->setName('author')
@ -102,11 +118,11 @@ class PhabricatorSearchController extends PhabricatorSearchBaseController {
->setDatasource('/typeahead/common/users/') ->setDatasource('/typeahead/common/users/')
->setValue($author_value)) ->setValue($author_value))
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormTokenizerControl())
->setLabel('Document Status') ->setName('owner')
->setName('open') ->setLabel('Owner')
->setOptions($status_options) ->setDatasource('/typeahead/common/users/')
->setValue($query->getParameter('open'))) ->setValue($owner_value))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Search')); ->setValue('Search'));

View file

@ -86,6 +86,12 @@ class PhabricatorSearchMySQLExecutor extends PhabricatorSearchExecutor {
'open', 'open',
PhabricatorSearchRelationship::RELATIONSHIP_OPEN); PhabricatorSearchRelationship::RELATIONSHIP_OPEN);
$join[] = $this->joinRelationship(
$conn_r,
$query,
'owner',
PhabricatorSearchRelationship::RELATIONSHIP_OWNER);
/* /*
$join[] = $this->joinRelationship( $join[] = $this->joinRelationship(
$conn_r, $conn_r,