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:
@@ -10,7 +10,7 @@ final class PhabricatorFileListController extends PhabricatorFileController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function willProcessRequest(array $data) {
|
||||||
$this->key = idx($data, 'key', 'authored');
|
$this->key = idx($data, 'key');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ final class PhabricatorMacroListController extends PhabricatorMacroController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function willProcessRequest(array $data) {
|
||||||
$this->key = idx($data, 'key', 'active');
|
$this->key = idx($data, 'key');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ final class PhabricatorPasteListController extends PhabricatorPasteController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function willProcessRequest(array $data) {
|
||||||
$this->queryKey = idx($data, 'queryKey', 'all');
|
$this->queryKey = idx($data, 'queryKey');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ final class PhabricatorPeopleListController extends PhabricatorPeopleController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function willProcessRequest(array $data) {
|
||||||
$this->key = idx($data, 'key', 'all');
|
$this->key = idx($data, 'key');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
|
|||||||
@@ -96,11 +96,13 @@ final class PhabricatorApplicationSearchController
|
|||||||
if ($this->queryKey == 'advanced') {
|
if ($this->queryKey == 'advanced') {
|
||||||
$run_query = false;
|
$run_query = false;
|
||||||
$query_key = $request->getStr('query');
|
$query_key = $request->getStr('query');
|
||||||
|
} else if (!strlen($this->queryKey)) {
|
||||||
|
$query_key = head_key($engine->loadEnabledNamedQueries());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($engine->isBuiltinQuery($query_key)) {
|
if ($engine->isBuiltinQuery($query_key)) {
|
||||||
$saved_query = $engine->buildSavedQueryFromBuiltin($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) {
|
} else if ($query_key) {
|
||||||
$saved_query = id(new PhabricatorSavedQueryQuery())
|
$saved_query = id(new PhabricatorSavedQueryQuery())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
@@ -111,12 +113,7 @@ final class PhabricatorApplicationSearchController
|
|||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
$named_query = id(new PhabricatorNamedQueryQuery())
|
$named_query = idx($engine->loadEnabledNamedQueries(), $query_key);
|
||||||
->setViewer($user)
|
|
||||||
->withQueryKeys(array($saved_query->getQueryKey()))
|
|
||||||
->withEngineClassNames(array(get_class($engine)))
|
|
||||||
->withUserPHIDs(array($user->getPHID()))
|
|
||||||
->executeOne();
|
|
||||||
} else {
|
} else {
|
||||||
$saved_query = $engine->buildSavedQueryFromRequest($request);
|
$saved_query = $engine->buildSavedQueryFromRequest($request);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user