Differential D14268 Diff 34547 src/applications/search/controller/PhabricatorSearchDeleteController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/controller/PhabricatorSearchDeleteController.php
<?php | <?php | ||||
final class PhabricatorSearchDeleteController | final class PhabricatorSearchDeleteController | ||||
extends PhabricatorSearchBaseController { | extends PhabricatorSearchBaseController { | ||||
private $queryKey; | public function handleRequest(AphrontRequest $request) { | ||||
private $engineClass; | $viewer = $this->getViewer(); | ||||
$key = $request->getURIData('queryKey'); | |||||
public function willProcessRequest(array $data) { | $engine_class = $request->getURIData('engine'); | ||||
epriestley: Did this change? Previously `$data['engine']`, now `getURIData('engineClass')`? I don't see a… | |||||
$this->queryKey = idx($data, 'queryKey'); | |||||
$this->engineClass = idx($data, 'engine'); | |||||
} | |||||
public function processRequest() { | |||||
$request = $this->getRequest(); | |||||
$user = $request->getUser(); | |||||
$key = $this->queryKey; | |||||
$base_class = 'PhabricatorApplicationSearchEngine'; | $base_class = 'PhabricatorApplicationSearchEngine'; | ||||
if (!is_subclass_of($this->engineClass, $base_class)) { | if (!is_subclass_of($engine_class, $base_class)) { | ||||
return new Aphront400Response(); | return new Aphront400Response(); | ||||
} | } | ||||
$engine = newv($this->engineClass, array()); | $engine = newv($engine_class, array()); | ||||
$engine->setViewer($user); | $engine->setViewer($viewer); | ||||
$named_query = id(new PhabricatorNamedQueryQuery()) | $named_query = id(new PhabricatorNamedQueryQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withEngineClassNames(array($this->engineClass)) | ->withEngineClassNames(array($engine_class)) | ||||
->withQueryKeys(array($key)) | ->withQueryKeys(array($key)) | ||||
->withUserPHIDs(array($user->getPHID())) | ->withUserPHIDs(array($viewer->getPHID())) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$named_query && $engine->isBuiltinQuery($key)) { | if (!$named_query && $engine->isBuiltinQuery($key)) { | ||||
$named_query = $engine->getBuiltinQuery($key); | $named_query = $engine->getBuiltinQuery($key); | ||||
} | } | ||||
if (!$named_query) { | if (!$named_query) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
Show All 38 Lines | if ($named_query->getIsBuiltin()) { | ||||
$desc = pht( | $desc = pht( | ||||
'Really delete the query "%s"? You can not undo this. Remember '. | 'Really delete the query "%s"? You can not undo this. Remember '. | ||||
'all the great times you had filtering results together?', | 'all the great times you had filtering results together?', | ||||
$named_query->getQueryName()); | $named_query->getQueryName()); | ||||
$button = pht('Delete Query'); | $button = pht('Delete Query'); | ||||
} | } | ||||
$dialog = id(new AphrontDialogView()) | $dialog = id(new AphrontDialogView()) | ||||
->setUser($user) | ->setUser($viewer) | ||||
->setTitle($title) | ->setTitle($title) | ||||
->appendChild($desc) | ->appendChild($desc) | ||||
->addCancelButton($return_uri) | ->addCancelButton($return_uri) | ||||
->addSubmitButton($button); | ->addSubmitButton($button); | ||||
return id(new AphrontDialogResponse())->setDialog($dialog); | return id(new AphrontDialogResponse())->setDialog($dialog); | ||||
} | } | ||||
} | } |
Did this change? Previously $data['engine'], now getURIData('engineClass')? I don't see a corresponding route change.