1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Modernize various menu collapse settings

Summary: Ref T4103. Fully modernize the filetree show/hide, durable column show/hide, and profile menu collapse/wide settings.

Test Plan:
  - Toggled filetree on/off, reloaded page, setting stuck.
  - Same with conpherence column and profile menus.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4103

Differential Revision: https://secure.phabricator.com/D16034
This commit is contained in:
epriestley 2016-06-03 12:23:15 -07:00
parent 804e7a6e06
commit fc45de29a6
10 changed files with 47 additions and 12 deletions

View file

@ -2144,6 +2144,7 @@ phutil_register_library_map(array(
'PhabricatorConfigVersionsModule' => 'applications/config/module/PhabricatorConfigVersionsModule.php',
'PhabricatorConfigWelcomeController' => 'applications/config/controller/PhabricatorConfigWelcomeController.php',
'PhabricatorConpherenceApplication' => 'applications/conpherence/application/PhabricatorConpherenceApplication.php',
'PhabricatorConpherenceColumnVisibleSetting' => 'applications/settings/setting/PhabricatorConpherenceColumnVisibleSetting.php',
'PhabricatorConpherenceNotificationsSetting' => 'applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php',
'PhabricatorConpherencePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php',
'PhabricatorConpherenceThreadPHIDType' => 'applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php',
@ -2515,6 +2516,7 @@ phutil_register_library_map(array(
'PhabricatorFilesManagementWorkflow' => 'applications/files/management/PhabricatorFilesManagementWorkflow.php',
'PhabricatorFilesOnDiskBuiltinFile' => 'applications/files/builtin/PhabricatorFilesOnDiskBuiltinFile.php',
'PhabricatorFilesOutboundRequestAction' => 'applications/files/action/PhabricatorFilesOutboundRequestAction.php',
'PhabricatorFiletreeVisibleSetting' => 'applications/settings/setting/PhabricatorFiletreeVisibleSetting.php',
'PhabricatorFlag' => 'applications/flag/storage/PhabricatorFlag.php',
'PhabricatorFlagAddFlagHeraldAction' => 'applications/flag/herald/PhabricatorFlagAddFlagHeraldAction.php',
'PhabricatorFlagColor' => 'applications/flag/constants/PhabricatorFlagColor.php',
@ -3049,6 +3051,7 @@ phutil_register_library_map(array(
'PhabricatorPolicyTestObject' => 'applications/policy/__tests__/PhabricatorPolicyTestObject.php',
'PhabricatorPolicyType' => 'applications/policy/constants/PhabricatorPolicyType.php',
'PhabricatorPonderApplication' => 'applications/ponder/application/PhabricatorPonderApplication.php',
'PhabricatorProfileMenuCollapsedSetting' => 'applications/settings/setting/PhabricatorProfileMenuCollapsedSetting.php',
'PhabricatorProfilePanel' => 'applications/search/profilepanel/PhabricatorProfilePanel.php',
'PhabricatorProfilePanelConfiguration' => 'applications/search/storage/PhabricatorProfilePanelConfiguration.php',
'PhabricatorProfilePanelConfigurationQuery' => 'applications/search/query/PhabricatorProfilePanelConfigurationQuery.php',
@ -6692,6 +6695,7 @@ phutil_register_library_map(array(
'PhabricatorConfigVersionsModule' => 'PhabricatorConfigModule',
'PhabricatorConfigWelcomeController' => 'PhabricatorConfigController',
'PhabricatorConpherenceApplication' => 'PhabricatorApplication',
'PhabricatorConpherenceColumnVisibleSetting' => 'PhabricatorInternalSetting',
'PhabricatorConpherenceNotificationsSetting' => 'PhabricatorSelectSetting',
'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel',
'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType',
@ -7126,6 +7130,7 @@ phutil_register_library_map(array(
'PhabricatorFilesManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorFilesOnDiskBuiltinFile' => 'PhabricatorFilesBuiltinFile',
'PhabricatorFilesOutboundRequestAction' => 'PhabricatorSystemAction',
'PhabricatorFiletreeVisibleSetting' => 'PhabricatorInternalSetting',
'PhabricatorFlag' => array(
'PhabricatorFlagDAO',
'PhabricatorPolicyInterface',
@ -7732,6 +7737,7 @@ phutil_register_library_map(array(
),
'PhabricatorPolicyType' => 'PhabricatorPolicyConstants',
'PhabricatorPonderApplication' => 'PhabricatorApplication',
'PhabricatorProfileMenuCollapsedSetting' => 'PhabricatorInternalSetting',
'PhabricatorProfilePanel' => 'Phobject',
'PhabricatorProfilePanelConfiguration' => array(
'PhabricatorSearchDAO',

View file

@ -108,7 +108,7 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
}
protected function getTagContent() {
$column_key = PhabricatorUserPreferences::PREFERENCE_CONPHERENCE_COLUMN;
$column_key = PhabricatorConpherenceColumnVisibleSetting::SETTINGKEY;
Javelin::initBehavior(
'durable-column',

View file

@ -381,7 +381,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
$nav = null;
if ($filetree_on) {
$collapsed_key = PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED;
$collapsed_key = PhabricatorFiletreeVisibleSetting::SETTINGKEY;
$collapsed_value = $viewer->getUserSetting($collapsed_key);
$nav = id(new DifferentialChangesetFileTreeSideNavBuilder())

View file

@ -329,7 +329,7 @@ final class DiffusionCommitController extends DiffusionController {
PhabricatorShowFiletreeSetting::SETTINGKEY,
PhabricatorShowFiletreeSetting::VALUE_ENABLE_FILETREE);
$pref_collapse = PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED;
$pref_collapse = PhabricatorFiletreeVisibleSetting::SETTINGKEY;
$collapsed = $viewer->getUserSetting($pref_collapse);
$nav = null;

View file

@ -382,8 +382,7 @@ abstract class PhabricatorProfilePanelEngine extends Phobject {
$collapse_id = celerity_generate_unique_node_id();
$viewer = $this->getViewer();
$collapse_key =
PhabricatorUserPreferences::PREFERENCE_PROFILE_MENU_COLLAPSED;
$collapse_key = PhabricatorProfileMenuCollapsedSetting::SETTINGKEY;
$is_collapsed = $viewer->getUserSetting($collapse_key);

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorConpherenceColumnVisibleSetting
extends PhabricatorInternalSetting {
const SETTINGKEY = 'conpherence-column';
public function getSettingName() {
return pht('Conpherence Column Visible');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorFiletreeVisibleSetting
extends PhabricatorInternalSetting {
const SETTINGKEY = 'nav-collapsed';
public function getSettingName() {
return pht('Filetree Visible');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorProfileMenuCollapsedSetting
extends PhabricatorInternalSetting {
const SETTINGKEY = 'profile-menu.collapsed';
public function getSettingName() {
return pht('Profile Menu Collapsed');
}
}

View file

@ -14,13 +14,7 @@ final class PhabricatorUserPreferences
const PREFERENCE_VARY_SUBJECT = 'vary-subject';
const PREFERENCE_HTML_EMAILS = 'html-emails';
const PREFERENCE_NAV_COLLAPSED = 'nav-collapsed';
const PREFERENCE_APP_TILES = 'app-tiles';
const PREFERENCE_APP_PINNED = 'app-pinned';
const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column';
const PREFERENCE_DESKTOP_NOTIFICATIONS = 'desktop-notifications';
const PREFERENCE_PROFILE_MENU_COLLAPSED = 'profile-menu.collapsed';
// These are in an unusual order for historic reasons.
const MAILTAG_PREFERENCE_NOTIFY = 0;

View file

@ -132,7 +132,7 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView
}
public function getDurableColumnVisible() {
$column_key = PhabricatorUserPreferences::PREFERENCE_CONPHERENCE_COLUMN;
$column_key = PhabricatorConpherenceColumnVisibleSetting::SETTINGKEY;
return (bool)$this->getUserPreference($column_key, false);
}