diff --git a/src/applications/paste/controller/PhabricatorPasteListController.php b/src/applications/paste/controller/PhabricatorPasteListController.php index 8243a8f71a..ed688a8567 100644 --- a/src/applications/paste/controller/PhabricatorPasteListController.php +++ b/src/applications/paste/controller/PhabricatorPasteListController.php @@ -58,14 +58,28 @@ final class PhabricatorPasteListController extends PhabricatorPasteController { $list->setNoDataString(pht("No results found for this query.")); if ($this->queryKey !== null || $filter == "filter/advanced") { - $form = $engine->buildSearchForm($saved_query); - $nav->appendChild($form); + $form = id(new AphrontFormView()) + ->setNoShading(true) + ->setUser($user); + + $engine->buildSearchForm($form, $saved_query); + + $submit = id(new AphrontFormSubmitControl()) + ->setValue(pht('Execute Query')); + + if ($filter == 'filter/advanced') { + $submit->addCancelButton( + '/search/edit/'.$saved_query->getQueryKey().'/', + pht('Save Custom Query...')); + } + + $form->appendChild($submit); + + $filter_view = id(new AphrontListFilterView())->appendChild($form); + $nav->appendChild($filter_view); } - $nav->appendChild( - array( - $list, - )); + $nav->appendChild($list); $crumbs = $this ->buildApplicationCrumbs($nav) diff --git a/src/applications/paste/query/PhabricatorPasteSearchEngine.php b/src/applications/paste/query/PhabricatorPasteSearchEngine.php index 2f2c652920..306fe8a573 100644 --- a/src/applications/paste/query/PhabricatorPasteSearchEngine.php +++ b/src/applications/paste/query/PhabricatorPasteSearchEngine.php @@ -18,7 +18,7 @@ final class PhabricatorPasteSearchEngine $saved = new PhabricatorSavedQuery(); $saved->setParameter( 'authorPHIDs', - array_values($request->getArr('set_users'))); + array_values($request->getArr('authors'))); try { $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); @@ -53,31 +53,21 @@ final class PhabricatorPasteSearchEngine * @param PhabricatorSavedQuery The query to populate the form with. * @return AphrontFormView The built form. */ - public function buildSearchForm(PhabricatorSavedQuery $saved_query) { + public function buildSearchForm( + AphrontFormView $form, + PhabricatorSavedQuery $saved_query) { $phids = $saved_query->getParameter('authorPHIDs', array()); $handles = id(new PhabricatorObjectHandleData($phids)) ->setViewer($this->requireViewer()) ->loadHandles(); - $users_searched = mpull($handles, 'getFullName', 'getPHID'); - - $form = id(new AphrontFormView()) - ->setUser($this->requireViewer()); + $author_tokens = mpull($handles, 'getFullName', 'getPHID'); $form->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/searchowner/') - ->setName('set_users') - ->setLabel(pht('Users')) - ->setValue($users_searched)); - - $form->appendChild( - id(new AphrontFormSubmitControl()) - ->setValue(pht('Query')) - ->addCancelButton( - '/search/edit/'.$saved_query->getQueryKey().'/', - pht('Save Custom Query...'))); - - return $form; + ->setDatasource('/typeahead/common/users/') + ->setName('authors') + ->setLabel(pht('Authors')) + ->setValue($author_tokens)); } public function getQueryResultsPageURI($query_key) { diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php index edfe8b1f4f..9527e129f4 100644 --- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php +++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php @@ -46,10 +46,13 @@ abstract class PhabricatorApplicationSearchEngine { /** * Builds the search form using the request. * + * @param AphrontFormView Form to populate. * @param PhabricatorSavedQuery The query from which to build the form. * @return void */ - abstract public function buildSearchForm(PhabricatorSavedQuery $query); + abstract public function buildSearchForm( + AphrontFormView $form, + PhabricatorSavedQuery $query); /**