1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 14:51:06 +01:00

Make query results page slightly more generic

Summary: Ref T2625. We currently hard-code the URI; instead, derive it from the Engine. I weakened the strength of getQueryResultsPageURI to let it build from a NamedQuery or a SavedQuery, because constructing a SavedQuery for a builtin NamedQuery is a bit of a pain.

Test Plan: Clicked links on the saved queries page, got query results.

Reviewers: btrahan, blc

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2625

Differential Revision: https://secure.phabricator.com/D6060
This commit is contained in:
epriestley 2013-05-27 13:43:02 -07:00
parent 3db82cb2ec
commit a67b1f950c
5 changed files with 9 additions and 8 deletions

View file

@ -22,7 +22,7 @@ final class PhabricatorPasteListController extends PhabricatorPasteController {
if ($request->isFormPost()) {
return id(new AphrontRedirectResponse())->setURI(
$engine->getQueryResultsPageURI(
$engine->buildSavedQueryFromRequest($request)));
$engine->buildSavedQueryFromRequest($request)->getQueryKey()));
}
$nav = $this->buildSideNavView();

View file

@ -31,7 +31,7 @@ final class PhabricatorPasteQueriesController
$item = id(new PhabricatorObjectItemView())
->setHeader($named_query->getQueryName())
->setHref('/paste/query/'.$named_query->getQueryKey().'/');
->setHref($engine->getQueryResultsPageURI($named_query->getQueryKey()));
if ($named_query->getIsBuiltin()) {
$item->addIcon('lock-grey', pht('Builtin'));

View file

@ -80,8 +80,8 @@ final class PhabricatorPasteSearchEngine
return $form;
}
public function getQueryResultsPageURI(PhabricatorSavedQuery $query) {
return '/paste/query/'.$query->getQueryKey().'/';
public function getQueryResultsPageURI($query_key) {
return '/paste/query/'.$query_key.'/';
}
public function getQueryManagementURI() {

View file

@ -44,7 +44,8 @@ final class PhabricatorSearchEditController
// If we haven't saved the query yet, this is a "Save..." operation, so
// take the user back to the query if they cancel instead of back to the
// management interface.
$cancel_uri = $engine->getQueryResultsPageURI($saved_query);
$cancel_uri = $engine->getQueryResultsPageURI(
$saved_query->getQueryKey());
}
$e_name = true;

View file

@ -56,11 +56,11 @@ abstract class PhabricatorApplicationSearchEngine {
* Return an application URI corresponding to the results page of a query.
* Normally, this is something like `/application/query/QUERYKEY/`.
*
* @param PhabricatorSavedQuery The query to build a URI for.
* @return string URI where the query can be executed.
* @param string The query key to build a URI for.
* @return string URI where the query can be executed.
* @task uri
*/
abstract public function getQueryResultsPageURI(PhabricatorSavedQuery $query);
abstract public function getQueryResultsPageURI($query_key);
/**