1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Default application search to the topmost filter

Summary: Allow users to set a default by dragging it to the top. When they land on a page without a saved query, choose their default.

Test Plan: Hit `/paste/`, got my default results, etc.

Reviewers: chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6140
This commit is contained in:
epriestley 2013-06-05 18:58:50 -07:00
parent 5f98c5f386
commit 7615e59cf9
5 changed files with 8 additions and 11 deletions

View file

@ -10,7 +10,7 @@ final class PhabricatorFileListController extends PhabricatorFileController
}
public function willProcessRequest(array $data) {
$this->key = idx($data, 'key', 'authored');
$this->key = idx($data, 'key');
}
public function processRequest() {

View file

@ -10,7 +10,7 @@ final class PhabricatorMacroListController extends PhabricatorMacroController
}
public function willProcessRequest(array $data) {
$this->key = idx($data, 'key', 'active');
$this->key = idx($data, 'key');
}
public function processRequest() {

View file

@ -10,7 +10,7 @@ final class PhabricatorPasteListController extends PhabricatorPasteController
}
public function willProcessRequest(array $data) {
$this->queryKey = idx($data, 'queryKey', 'all');
$this->queryKey = idx($data, 'queryKey');
}
public function processRequest() {

View file

@ -14,7 +14,7 @@ final class PhabricatorPeopleListController extends PhabricatorPeopleController
}
public function willProcessRequest(array $data) {
$this->key = idx($data, 'key', 'all');
$this->key = idx($data, 'key');
}
public function processRequest() {

View file

@ -96,11 +96,13 @@ final class PhabricatorApplicationSearchController
if ($this->queryKey == 'advanced') {
$run_query = false;
$query_key = $request->getStr('query');
} else if (!strlen($this->queryKey)) {
$query_key = head_key($engine->loadEnabledNamedQueries());
}
if ($engine->isBuiltinQuery($query_key)) {
$saved_query = $engine->buildSavedQueryFromBuiltin($query_key);
$named_query = $engine->getBuiltinQuery($query_key);
$named_query = idx($engine->loadEnabledNamedQueries(), $query_key);
} else if ($query_key) {
$saved_query = id(new PhabricatorSavedQueryQuery())
->setViewer($user)
@ -111,12 +113,7 @@ final class PhabricatorApplicationSearchController
return new Aphront404Response();
}
$named_query = id(new PhabricatorNamedQueryQuery())
->setViewer($user)
->withQueryKeys(array($saved_query->getQueryKey()))
->withEngineClassNames(array(get_class($engine)))
->withUserPHIDs(array($user->getPHID()))
->executeOne();
$named_query = idx($engine->loadEnabledNamedQueries(), $query_key);
} else {
$saved_query = $engine->buildSavedQueryFromRequest($request);
}