Skip to content

Commit 7615e59

Browse files
author
epriestley
committed
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
1 parent 5f98c5f commit 7615e59

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

src/applications/files/controller/PhabricatorFileListController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function shouldAllowPublic() {
1010
}
1111

1212
public function willProcessRequest(array $data) {
13-
$this->key = idx($data, 'key', 'authored');
13+
$this->key = idx($data, 'key');
1414
}
1515

1616
public function processRequest() {

src/applications/macro/controller/PhabricatorMacroListController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function shouldAllowPublic() {
1010
}
1111

1212
public function willProcessRequest(array $data) {
13-
$this->key = idx($data, 'key', 'active');
13+
$this->key = idx($data, 'key');
1414
}
1515

1616
public function processRequest() {

src/applications/paste/controller/PhabricatorPasteListController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function shouldAllowPublic() {
1010
}
1111

1212
public function willProcessRequest(array $data) {
13-
$this->queryKey = idx($data, 'queryKey', 'all');
13+
$this->queryKey = idx($data, 'queryKey');
1414
}
1515

1616
public function processRequest() {

src/applications/people/controller/PhabricatorPeopleListController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function shouldRequireAdmin() {
1414
}
1515

1616
public function willProcessRequest(array $data) {
17-
$this->key = idx($data, 'key', 'all');
17+
$this->key = idx($data, 'key');
1818
}
1919

2020
public function processRequest() {

src/applications/search/controller/PhabricatorApplicationSearchController.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ private function processSearchRequest() {
9696
if ($this->queryKey == 'advanced') {
9797
$run_query = false;
9898
$query_key = $request->getStr('query');
99+
} else if (!strlen($this->queryKey)) {
100+
$query_key = head_key($engine->loadEnabledNamedQueries());
99101
}
100102

101103
if ($engine->isBuiltinQuery($query_key)) {
102104
$saved_query = $engine->buildSavedQueryFromBuiltin($query_key);
103-
$named_query = $engine->getBuiltinQuery($query_key);
105+
$named_query = idx($engine->loadEnabledNamedQueries(), $query_key);
104106
} else if ($query_key) {
105107
$saved_query = id(new PhabricatorSavedQueryQuery())
106108
->setViewer($user)
@@ -111,12 +113,7 @@ private function processSearchRequest() {
111113
return new Aphront404Response();
112114
}
113115

114-
$named_query = id(new PhabricatorNamedQueryQuery())
115-
->setViewer($user)
116-
->withQueryKeys(array($saved_query->getQueryKey()))
117-
->withEngineClassNames(array(get_class($engine)))
118-
->withUserPHIDs(array($user->getPHID()))
119-
->executeOne();
116+
$named_query = idx($engine->loadEnabledNamedQueries(), $query_key);
120117
} else {
121118
$saved_query = $engine->buildSavedQueryFromRequest($request);
122119
}

0 commit comments

Comments
 (0)