@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a global setting for controlling the default main menu search scope

Summary: Fixes T13405. The default behavior of the global search bar isn't currently configurable, but can be made configurable fairly easily.

Test Plan: Changed setting as an administrator, saw setting reflected as a user with no previous preference. As a user with an existing preference, saw preference retained.

Maniphest Tasks: T13405

Differential Revision: https://secure.phabricator.com/D20787

+75 -5
+3 -1
src/__phutil_library_map__.php
··· 4655 4655 'PhabricatorSearchScopeSetting' => 'applications/settings/setting/PhabricatorSearchScopeSetting.php', 4656 4656 'PhabricatorSearchSelectField' => 'applications/search/field/PhabricatorSearchSelectField.php', 4657 4657 'PhabricatorSearchService' => 'infrastructure/cluster/search/PhabricatorSearchService.php', 4658 + 'PhabricatorSearchSettingsPanel' => 'applications/settings/panel/PhabricatorSearchSettingsPanel.php', 4658 4659 'PhabricatorSearchStringListField' => 'applications/search/field/PhabricatorSearchStringListField.php', 4659 4660 'PhabricatorSearchSubscribersField' => 'applications/search/field/PhabricatorSearchSubscribersField.php', 4660 4661 'PhabricatorSearchTextField' => 'applications/search/field/PhabricatorSearchTextField.php', ··· 11248 11249 'PhabricatorSearchResultBucketGroup' => 'Phobject', 11249 11250 'PhabricatorSearchResultView' => 'AphrontView', 11250 11251 'PhabricatorSearchSchemaSpec' => 'PhabricatorConfigSchemaSpec', 11251 - 'PhabricatorSearchScopeSetting' => 'PhabricatorInternalSetting', 11252 + 'PhabricatorSearchScopeSetting' => 'PhabricatorSelectSetting', 11252 11253 'PhabricatorSearchSelectField' => 'PhabricatorSearchField', 11253 11254 'PhabricatorSearchService' => 'Phobject', 11255 + 'PhabricatorSearchSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 11254 11256 'PhabricatorSearchStringListField' => 'PhabricatorSearchField', 11255 11257 'PhabricatorSearchSubscribersField' => 'PhabricatorSearchTokenizerField', 11256 11258 'PhabricatorSearchTextField' => 'PhabricatorSearchField',
+28
src/applications/settings/panel/PhabricatorSearchSettingsPanel.php
··· 1 + <?php 2 + 3 + final class PhabricatorSearchSettingsPanel 4 + extends PhabricatorEditEngineSettingsPanel { 5 + 6 + const PANELKEY = 'search'; 7 + 8 + public function getPanelName() { 9 + return pht('Search'); 10 + } 11 + 12 + public function getPanelMenuIcon() { 13 + return 'fa-search'; 14 + } 15 + 16 + public function getPanelGroupKey() { 17 + return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY; 18 + } 19 + 20 + public function isTemplatePanel() { 21 + return true; 22 + } 23 + 24 + public function isUserPanel() { 25 + return false; 26 + } 27 + 28 + }
+26 -1
src/applications/settings/setting/PhabricatorSearchScopeSetting.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorSearchScopeSetting 4 - extends PhabricatorInternalSetting { 4 + extends PhabricatorSelectSetting { 5 5 6 6 const SETTINGKEY = 'search-scope'; 7 7 ··· 9 9 return pht('Search Scope'); 10 10 } 11 11 12 + public function getSettingPanelKey() { 13 + return PhabricatorSearchSettingsPanel::PANELKEY; 14 + } 15 + 12 16 public function getSettingDefaultValue() { 13 17 return 'all'; 18 + } 19 + 20 + protected function getControlInstructions() { 21 + return pht( 22 + 'Choose the default behavior of the global search in the main menu.'); 23 + } 24 + 25 + protected function getSelectOptions() { 26 + $scopes = PhabricatorMainMenuSearchView::getGlobalSearchScopeItems( 27 + $this->getViewer(), 28 + new PhabricatorSettingsApplication()); 29 + 30 + $scope_map = array(); 31 + foreach ($scopes as $scope) { 32 + if (!isset($scope['value'])) { 33 + continue; 34 + } 35 + $scope_map[$scope['value']] = $scope['name']; 36 + } 37 + 38 + return $scope_map; 14 39 } 15 40 16 41 }
+18 -3
src/view/page/menu/PhabricatorMainMenuSearchView.php
··· 116 116 return $form; 117 117 } 118 118 119 - private function buildModeSelector($selector_id, $application_id) { 120 - $viewer = $this->getViewer(); 119 + public static function getGlobalSearchScopeItems( 120 + PhabricatorUser $viewer, 121 + PhabricatorApplication $application) { 121 122 122 123 $items = array(); 123 124 $items[] = array( ··· 132 133 133 134 $application_value = null; 134 135 $application_icon = self::DEFAULT_APPLICATION_ICON; 135 - $application = $this->getApplication(); 136 136 if ($application) { 137 137 $application_value = get_class($application); 138 138 if ($application->getApplicationSearchDocumentTypes()) { ··· 185 185 'href' => PhabricatorEnv::getDoclink('Search User Guide'), 186 186 ); 187 187 188 + return $items; 189 + } 190 + 191 + private function buildModeSelector($selector_id, $application_id) { 192 + $viewer = $this->getViewer(); 193 + 194 + $items = self::getGlobalSearchScopeItems($viewer, $this->getApplication()); 195 + 188 196 $scope_key = PhabricatorSearchScopeSetting::SETTINGKEY; 189 197 $current_value = $viewer->getUserSetting($scope_key); 190 198 ··· 194 202 $current_icon = $item['icon']; 195 203 break; 196 204 } 205 + } 206 + 207 + $application = $this->getApplication(); 208 + 209 + $application_value = null; 210 + if ($application) { 211 + $application_value = get_class($application); 197 212 } 198 213 199 214 $selector = id(new PHUIButtonView())