mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Don't offer personal saved queries in global "Search Scope" settings dropdown
Summary: Fixes T13405. We currently offer non-global custom saved queries here, but this doesn't make sense as a global default setting. Test Plan: Saved a global search query, edited global search settings, no longer saw the non-global query as an option. Maniphest Tasks: T13405 Differential Revision: https://secure.phabricator.com/D20793
This commit is contained in:
parent
63c7302af1
commit
278092974f
2 changed files with 16 additions and 4 deletions
|
@ -25,7 +25,8 @@ final class PhabricatorSearchScopeSetting
|
||||||
protected function getSelectOptions() {
|
protected function getSelectOptions() {
|
||||||
$scopes = PhabricatorMainMenuSearchView::getGlobalSearchScopeItems(
|
$scopes = PhabricatorMainMenuSearchView::getGlobalSearchScopeItems(
|
||||||
$this->getViewer(),
|
$this->getViewer(),
|
||||||
new PhabricatorSettingsApplication());
|
new PhabricatorSettingsApplication(),
|
||||||
|
$only_global = true);
|
||||||
|
|
||||||
$scope_map = array();
|
$scope_map = array();
|
||||||
foreach ($scopes as $scope) {
|
foreach ($scopes as $scope) {
|
||||||
|
|
|
@ -118,7 +118,8 @@ final class PhabricatorMainMenuSearchView extends AphrontView {
|
||||||
|
|
||||||
public static function getGlobalSearchScopeItems(
|
public static function getGlobalSearchScopeItems(
|
||||||
PhabricatorUser $viewer,
|
PhabricatorUser $viewer,
|
||||||
PhabricatorApplication $application = null) {
|
PhabricatorApplication $application = null,
|
||||||
|
$global_only = false) {
|
||||||
|
|
||||||
$items = array();
|
$items = array();
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
|
@ -154,14 +155,24 @@ final class PhabricatorMainMenuSearchView extends AphrontView {
|
||||||
$engine = id(new PhabricatorSearchApplicationSearchEngine())
|
$engine = id(new PhabricatorSearchApplicationSearchEngine())
|
||||||
->setViewer($viewer);
|
->setViewer($viewer);
|
||||||
$engine_queries = $engine->loadEnabledNamedQueries();
|
$engine_queries = $engine->loadEnabledNamedQueries();
|
||||||
$query_map = mpull($engine_queries, 'getQueryName', 'getQueryKey');
|
foreach ($engine_queries as $query) {
|
||||||
foreach ($query_map as $query_key => $query_name) {
|
$query_key = $query->getQueryKey();
|
||||||
if ($query_key == 'all') {
|
if ($query_key == 'all') {
|
||||||
// Skip the builtin "All" query since it's redundant with the default
|
// Skip the builtin "All" query since it's redundant with the default
|
||||||
// setting.
|
// setting.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In the global "Settings" panel, we don't want to offer personal
|
||||||
|
// queries the viewer may have saved.
|
||||||
|
if ($global_only) {
|
||||||
|
if (!$query->isGlobal()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query_name = $query->getQueryName();
|
||||||
|
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'icon' => 'fa-certificate',
|
'icon' => 'fa-certificate',
|
||||||
'name' => $query_name,
|
'name' => $query_name,
|
||||||
|
|
Loading…
Reference in a new issue