diff --git a/src/applications/search/controller/PhabricatorSearchController.php b/src/applications/search/controller/PhabricatorSearchController.php --- a/src/applications/search/controller/PhabricatorSearchController.php +++ b/src/applications/search/controller/PhabricatorSearchController.php @@ -5,19 +5,12 @@ const SCOPE_CURRENT_APPLICATION = 'application'; - private $queryKey; - public function shouldAllowPublic() { return true; } - public function willProcessRequest(array $data) { - $this->queryKey = idx($data, 'queryKey'); - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $this->getViewer(); if ($request->getStr('jump') != 'no') { $pref_jump = PhabricatorUserPreferences::PREFERENCE_SEARCHBAR_JUMP; @@ -97,7 +90,7 @@ } $controller = id(new PhabricatorApplicationSearchController()) - ->setQueryKey($this->queryKey) + ->setQueryKey($request->getURIData('queryKey')) ->setSearchEngine($engine) ->setNavigation($this->buildSideNavView()); @@ -105,7 +98,7 @@ } public function buildSideNavView($for_app = false) { - $viewer = $this->getRequest()->getUser(); + $viewer = $this->getViewer(); $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); diff --git a/src/applications/search/controller/PhabricatorSearchDeleteController.php b/src/applications/search/controller/PhabricatorSearchDeleteController.php --- a/src/applications/search/controller/PhabricatorSearchDeleteController.php +++ b/src/applications/search/controller/PhabricatorSearchDeleteController.php @@ -3,33 +3,24 @@ final class PhabricatorSearchDeleteController extends PhabricatorSearchBaseController { - private $queryKey; - private $engineClass; - - public function willProcessRequest(array $data) { - $this->queryKey = idx($data, 'queryKey'); - $this->engineClass = idx($data, 'engine'); - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); - - $key = $this->queryKey; + public function handleRequest(AphrontRequest $request) { + $viewer = $this->getViewer(); + $key = $request->getURIData('queryKey'); + $engine_class = $request->getURIData('engine'); $base_class = 'PhabricatorApplicationSearchEngine'; - if (!is_subclass_of($this->engineClass, $base_class)) { + if (!is_subclass_of($engine_class, $base_class)) { return new Aphront400Response(); } - $engine = newv($this->engineClass, array()); - $engine->setViewer($user); + $engine = newv($engine_class, array()); + $engine->setViewer($viewer); $named_query = id(new PhabricatorNamedQueryQuery()) - ->setViewer($user) - ->withEngineClassNames(array($this->engineClass)) + ->setViewer($viewer) + ->withEngineClassNames(array($engine_class)) ->withQueryKeys(array($key)) - ->withUserPHIDs(array($user->getPHID())) + ->withUserPHIDs(array($viewer->getPHID())) ->executeOne(); if (!$named_query && $engine->isBuiltinQuery($key)) { @@ -84,7 +75,7 @@ } $dialog = id(new AphrontDialogView()) - ->setUser($user) + ->setUser($viewer) ->setTitle($title) ->appendChild($desc) ->addCancelButton($return_uri) diff --git a/src/applications/search/controller/PhabricatorSearchEditController.php b/src/applications/search/controller/PhabricatorSearchEditController.php --- a/src/applications/search/controller/PhabricatorSearchEditController.php +++ b/src/applications/search/controller/PhabricatorSearchEditController.php @@ -3,38 +3,31 @@ final class PhabricatorSearchEditController extends PhabricatorSearchBaseController { - private $queryKey; - - public function willProcessRequest(array $data) { - $this->queryKey = idx($data, 'queryKey'); - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $this->getViewer(); $saved_query = id(new PhabricatorSavedQueryQuery()) - ->setViewer($user) - ->withQueryKeys(array($this->queryKey)) + ->setViewer($viewer) + ->withQueryKeys(array($request->getURIData('queryKey'))) ->executeOne(); if (!$saved_query) { return new Aphront404Response(); } - $engine = $saved_query->newEngine()->setViewer($user); + $engine = $saved_query->newEngine()->setViewer($viewer); $complete_uri = $engine->getQueryManagementURI(); $cancel_uri = $complete_uri; $named_query = id(new PhabricatorNamedQueryQuery()) - ->setViewer($user) + ->setViewer($viewer) ->withQueryKeys(array($saved_query->getQueryKey())) - ->withUserPHIDs(array($user->getPHID())) + ->withUserPHIDs(array($viewer->getPHID())) ->executeOne(); if (!$named_query) { $named_query = id(new PhabricatorNamedQuery()) - ->setUserPHID($user->getPHID()) + ->setUserPHID($viewer->getPHID()) ->setQueryKey($saved_query->getQueryKey()) ->setEngineClassName($saved_query->getEngineClassName()); @@ -64,7 +57,7 @@ } $form = id(new AphrontFormView()) - ->setUser($user); + ->setUser($viewer); $form->appendChild( id(new AphrontFormTextControl()) diff --git a/src/applications/search/controller/PhabricatorSearchHovercardController.php b/src/applications/search/controller/PhabricatorSearchHovercardController.php --- a/src/applications/search/controller/PhabricatorSearchHovercardController.php +++ b/src/applications/search/controller/PhabricatorSearchHovercardController.php @@ -9,7 +9,6 @@ public function handleRequest(AphrontRequest $request) { $viewer = $this->getViewer(); - $phids = $request->getArr('phids'); $handles = id(new PhabricatorHandleQuery()) diff --git a/src/applications/search/controller/PhabricatorSearchOrderController.php b/src/applications/search/controller/PhabricatorSearchOrderController.php --- a/src/applications/search/controller/PhabricatorSearchOrderController.php +++ b/src/applications/search/controller/PhabricatorSearchOrderController.php @@ -3,25 +3,19 @@ final class PhabricatorSearchOrderController extends PhabricatorSearchBaseController { - private $engineClass; - - public function willProcessRequest(array $data) { - $this->engineClass = idx($data, 'engine'); - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $this->getViewer(); + $engine_class = $request->getURIData('engine'); $request->validateCSRF(); $base_class = 'PhabricatorApplicationSearchEngine'; - if (!is_subclass_of($this->engineClass, $base_class)) { + if (!is_subclass_of($engine_class, $base_class)) { return new Aphront400Response(); } - $engine = newv($this->engineClass, array()); - $engine->setViewer($user); + $engine = newv($engine_class, array()); + $engine->setViewer($viewer); $queries = $engine->loadAllNamedQueries(); $queries = mpull($queries, null, 'getQueryKey');