mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Accept GET requests for jump nav
Summary: The URL /jump/?jump=%s now does the same thing as the POST version, except that if it couldn't jump to anything, it loads /jump/ with the query filled in so you can just press enter (we don't save searches without a CSRF token). (hsb: Sorry for stealing your task! It hadn't been updated in two months so I figured you were likely not actively working on it.) Test Plan: Loaded given URL with different queries (including various flavors of nothing). Search worked as expected. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1036 Differential Revision: https://secure.phabricator.com/D3047
This commit is contained in:
parent
7d9960e522
commit
afa2dbc3dc
1 changed files with 13 additions and 14 deletions
|
@ -105,13 +105,12 @@ final class PhabricatorDirectoryMainController
|
|||
private function buildJumpResponse($nav) {
|
||||
$request = $this->getRequest();
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$jump = $request->getStr('jump');
|
||||
|
||||
$response = PhabricatorJumpNavHandler::jumpPostResponse($jump);
|
||||
if ($response) {
|
||||
return $response;
|
||||
} else {
|
||||
} else if ($request->isFormPost()) {
|
||||
$query = new PhabricatorSearchQuery();
|
||||
$query->setQuery($jump);
|
||||
$query->save();
|
||||
|
@ -119,10 +118,9 @@ final class PhabricatorDirectoryMainController
|
|||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/search/'.$query->getQueryKey().'/');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$nav->appendChild($this->buildJumpPanel());
|
||||
$nav->appendChild($this->buildJumpPanel($jump));
|
||||
return $this->buildStandardPageResponse(
|
||||
$nav,
|
||||
array(
|
||||
|
@ -430,7 +428,7 @@ final class PhabricatorDirectoryMainController
|
|||
'</div>';
|
||||
}
|
||||
|
||||
private function buildJumpPanel() {
|
||||
private function buildJumpPanel($query=null) {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
|
@ -459,6 +457,7 @@ final class PhabricatorDirectoryMainController
|
|||
'class' => 'phabricator-jump-nav',
|
||||
'name' => 'jump',
|
||||
'id' => $uniq_id,
|
||||
'value' => $query,
|
||||
));
|
||||
$jump_caption = phutil_render_tag(
|
||||
'p',
|
||||
|
|
Loading…
Reference in a new issue