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

Modularize all straightforward settings

Summary:
Ref T4103. This tackles all the easy stuff. Not yet handled:

  - Translation, pronoun, timezone: these are weird and stored on the User object instead of in settings.
  - Conpherence default: actually just missed this one, it's normal.
  - 1000 dropdowns for email notification preferences (messy, technically).

Test Plan:
wow look at all these settings

{F1670442}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4103

Differential Revision: https://secure.phabricator.com/D15999
This commit is contained in:
epriestley 2016-06-01 09:21:04 -07:00
parent 39cb5e7211
commit 7fe1a6840e
10 changed files with 335 additions and 0 deletions

View file

@ -2239,6 +2239,7 @@ phutil_register_library_map(array(
'PhabricatorDaemonsApplication' => 'applications/daemon/application/PhabricatorDaemonsApplication.php',
'PhabricatorDaemonsSetupCheck' => 'applications/config/check/PhabricatorDaemonsSetupCheck.php',
'PhabricatorDailyRoutineTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorDailyRoutineTriggerClock.php',
'PhabricatorDarkConsoleSetting' => 'applications/settings/setting/PhabricatorDarkConsoleSetting.php',
'PhabricatorDashboard' => 'applications/dashboard/storage/PhabricatorDashboard.php',
'PhabricatorDashboardAddPanelController' => 'applications/dashboard/controller/PhabricatorDashboardAddPanelController.php',
'PhabricatorDashboardApplication' => 'applications/dashboard/application/PhabricatorDashboardApplication.php',
@ -2296,6 +2297,7 @@ phutil_register_library_map(array(
'PhabricatorDatabaseSetupCheck' => 'applications/config/check/PhabricatorDatabaseSetupCheck.php',
'PhabricatorDatasourceEditField' => 'applications/transactions/editfield/PhabricatorDatasourceEditField.php',
'PhabricatorDatasourceEditType' => 'applications/transactions/edittype/PhabricatorDatasourceEditType.php',
'PhabricatorDateFormatSetting' => 'applications/settings/setting/PhabricatorDateFormatSetting.php',
'PhabricatorDateTimeSettingsPanel' => 'applications/settings/panel/PhabricatorDateTimeSettingsPanel.php',
'PhabricatorDebugController' => 'applications/system/controller/PhabricatorDebugController.php',
'PhabricatorDefaultRequestExceptionHandler' => 'aphront/handler/PhabricatorDefaultRequestExceptionHandler.php',
@ -2380,9 +2382,14 @@ phutil_register_library_map(array(
'PhabricatorElasticSearchSetupCheck' => 'applications/config/check/PhabricatorElasticSearchSetupCheck.php',
'PhabricatorEmailAddressesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php',
'PhabricatorEmailContentSource' => 'applications/metamta/contentsource/PhabricatorEmailContentSource.php',
'PhabricatorEmailFormatSetting' => 'applications/settings/setting/PhabricatorEmailFormatSetting.php',
'PhabricatorEmailFormatSettingsPanel' => 'applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php',
'PhabricatorEmailLoginController' => 'applications/auth/controller/PhabricatorEmailLoginController.php',
'PhabricatorEmailNotificationsSetting' => 'applications/settings/setting/PhabricatorEmailNotificationsSetting.php',
'PhabricatorEmailPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php',
'PhabricatorEmailRePrefixSetting' => 'applications/settings/setting/PhabricatorEmailRePrefixSetting.php',
'PhabricatorEmailSelfActionsSetting' => 'applications/settings/setting/PhabricatorEmailSelfActionsSetting.php',
'PhabricatorEmailVarySubjectsSetting' => 'applications/settings/setting/PhabricatorEmailVarySubjectsSetting.php',
'PhabricatorEmailVerificationController' => 'applications/auth/controller/PhabricatorEmailVerificationController.php',
'PhabricatorEmbedFileRemarkupRule' => 'applications/files/markup/PhabricatorEmbedFileRemarkupRule.php',
'PhabricatorEmojiRemarkupRule' => 'applications/macro/markup/PhabricatorEmojiRemarkupRule.php',
@ -3525,6 +3532,7 @@ phutil_register_library_map(array(
'PhabricatorTextAreaEditField' => 'applications/transactions/editfield/PhabricatorTextAreaEditField.php',
'PhabricatorTextEditField' => 'applications/transactions/editfield/PhabricatorTextEditField.php',
'PhabricatorTime' => 'infrastructure/time/PhabricatorTime.php',
'PhabricatorTimeFormatSetting' => 'applications/settings/setting/PhabricatorTimeFormatSetting.php',
'PhabricatorTimeGuard' => 'infrastructure/time/PhabricatorTimeGuard.php',
'PhabricatorTimeTestCase' => 'infrastructure/time/__tests__/PhabricatorTimeTestCase.php',
'PhabricatorTimezoneSetupCheck' => 'applications/config/check/PhabricatorTimezoneSetupCheck.php',
@ -3629,6 +3637,7 @@ phutil_register_library_map(array(
'PhabricatorViewerDatasource' => 'applications/people/typeahead/PhabricatorViewerDatasource.php',
'PhabricatorWatcherHasObjectEdgeType' => 'applications/transactions/edges/PhabricatorWatcherHasObjectEdgeType.php',
'PhabricatorWebContentSource' => 'infrastructure/contentsource/PhabricatorWebContentSource.php',
'PhabricatorWeekStartDaySetting' => 'applications/settings/setting/PhabricatorWeekStartDaySetting.php',
'PhabricatorWordPressAuthProvider' => 'applications/auth/provider/PhabricatorWordPressAuthProvider.php',
'PhabricatorWorker' => 'infrastructure/daemon/workers/PhabricatorWorker.php',
'PhabricatorWorkerActiveTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php',
@ -6763,6 +6772,7 @@ phutil_register_library_map(array(
'PhabricatorDaemonsApplication' => 'PhabricatorApplication',
'PhabricatorDaemonsSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorDailyRoutineTriggerClock' => 'PhabricatorTriggerClock',
'PhabricatorDarkConsoleSetting' => 'PhabricatorSelectSetting',
'PhabricatorDashboard' => array(
'PhabricatorDashboardDAO',
'PhabricatorApplicationTransactionInterface',
@ -6838,6 +6848,7 @@ phutil_register_library_map(array(
'PhabricatorDatabaseSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorDatasourceEditField' => 'PhabricatorTokenizerEditField',
'PhabricatorDatasourceEditType' => 'PhabricatorPHIDListEditType',
'PhabricatorDateFormatSetting' => 'PhabricatorSelectSetting',
'PhabricatorDateTimeSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorDebugController' => 'PhabricatorController',
'PhabricatorDefaultRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler',
@ -6928,9 +6939,14 @@ phutil_register_library_map(array(
'PhabricatorElasticSearchSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorEmailContentSource' => 'PhabricatorContentSource',
'PhabricatorEmailFormatSetting' => 'PhabricatorSelectSetting',
'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorEmailLoginController' => 'PhabricatorAuthController',
'PhabricatorEmailNotificationsSetting' => 'PhabricatorSelectSetting',
'PhabricatorEmailPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorEmailRePrefixSetting' => 'PhabricatorSelectSetting',
'PhabricatorEmailSelfActionsSetting' => 'PhabricatorSelectSetting',
'PhabricatorEmailVarySubjectsSetting' => 'PhabricatorSelectSetting',
'PhabricatorEmailVerificationController' => 'PhabricatorAuthController',
'PhabricatorEmbedFileRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PhabricatorEmojiRemarkupRule' => 'PhutilRemarkupRule',
@ -8272,6 +8288,7 @@ phutil_register_library_map(array(
'PhabricatorTextAreaEditField' => 'PhabricatorEditField',
'PhabricatorTextEditField' => 'PhabricatorEditField',
'PhabricatorTime' => 'Phobject',
'PhabricatorTimeFormatSetting' => 'PhabricatorSelectSetting',
'PhabricatorTimeGuard' => 'Phobject',
'PhabricatorTimeTestCase' => 'PhabricatorTestCase',
'PhabricatorTimezoneSetupCheck' => 'PhabricatorSetupCheck',
@ -8403,6 +8420,7 @@ phutil_register_library_map(array(
'PhabricatorViewerDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorWatcherHasObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorWebContentSource' => 'PhabricatorContentSource',
'PhabricatorWeekStartDaySetting' => 'PhabricatorSelectSetting',
'PhabricatorWordPressAuthProvider' => 'PhabricatorOAuth2AuthProvider',
'PhabricatorWorker' => 'Phobject',
'PhabricatorWorkerActiveTask' => 'PhabricatorWorkerTask',

View file

@ -0,0 +1,34 @@
<?php
final class PhabricatorDarkConsoleSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'dark_console';
const VALUE_DARKCONSOLE_DISABLED = '0';
const VALUE_DARKCONSOLE_ENABLED = '1';
public function getSettingName() {
return pht('DarkConsole');
}
protected function getControlInstructions() {
return pht(
'DarkConsole is a debugging console for developing and troubleshooting '.
'Phabricator applications. After enabling DarkConsole, press the '.
'{nav `} key on your keyboard to toggle it on or off.');
}
public function getSettingDefaultValue() {
return self::VALUE_DARKCONSOLE_DISABLED;
}
protected function getSelectOptions() {
return array(
self::VALUE_DARKCONSOLE_DISABLED => pht('Disable DarkConsole'),
self::VALUE_DARKCONSOLE_ENABLED => pht('Enable DarkConsole'),
);
}
}

View file

@ -0,0 +1,34 @@
<?php
final class PhabricatorDateFormatSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'date-format';
const VALUE_FORMAT_ISO = 'Y-m-d';
const VALUE_FORMAT_US = 'n/j/Y';
const VALUE_FORMAT_EUROPE = 'd-m-Y';
public function getSettingName() {
return pht('Date Format');
}
protected function getControlInstructions() {
return pht(
'Select the format you prefer for editing dates.');
}
public function getSettingDefaultValue() {
return self::VALUE_FORMAT_ISO;
}
protected function getSelectOptions() {
return array(
self::VALUE_FORMAT_ISO => pht('ISO 8601: 2000-02-28'),
self::VALUE_FORMAT_US => pht('US: 2/28/2000'),
self::VALUE_FORMAT_EUROPE => pht('Europe: 28-02-2000'),
);
}
}

View file

@ -0,0 +1,32 @@
<?php
final class PhabricatorEmailFormatSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'html-emails';
const VALUE_HTML_EMAIL = 'true';
const VALUE_TEXT_EMAIL = 'false';
public function getSettingName() {
return pht('HTML Email');
}
protected function getControlInstructions() {
return pht(
'You can opt to receive plain text email from Phabricator instead '.
'of HTML email. Plain text email works better with some clients.');
}
public function getSettingDefaultValue() {
return self::VALUE_HTML_EMAIL;
}
protected function getSelectOptions() {
return array(
self::VALUE_HTML_EMAIL => pht('Send HTML Email'),
self::VALUE_TEXT_EMAIL => pht('Send Plain Text Email'),
);
}
}

View file

@ -0,0 +1,36 @@
<?php
final class PhabricatorEmailNotificationsSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'no-mail';
const VALUE_SEND_MAIL = '0';
const VALUE_NO_MAIL = '1';
public function getSettingName() {
return pht('Email Notifications');
}
protected function getControlInstructions() {
return pht(
'If you disable **Email Notifications**, Phabricator will never '.
'send email to notify you about events. This preference overrides '.
'all your other settings.'.
"\n\n".
"//You will still receive some administrative email, like password ".
"reset email.//");
}
public function getSettingDefaultValue() {
return self::VALUE_SEND_MAIL;
}
protected function getSelectOptions() {
return array(
self::VALUE_SEND_MAIL => pht('Enable Email Notifications'),
self::VALUE_NO_MAIL => pht('Disable Email Notifications'),
);
}
}

View file

@ -0,0 +1,40 @@
<?php
final class PhabricatorEmailRePrefixSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 're-prefix';
const VALUE_RE_PREFIX = 'true';
const VALUE_NO_PREFIX = 'false';
public function getSettingName() {
return pht('Add "Re:" Prefix');
}
protected function getControlInstructions() {
return pht(
'The **Add "Re:" Prefix** setting adds "Re:" in front of all messages, '.
'even if they are not replies. If you use **Mail.app** on Mac OS X, '.
'this may improve mail threading.'.
"\n\n".
"| Setting | Example Mail Subject\n".
"|------------------------|----------------\n".
"| Enable \"Re:\" Prefix | ".
"`Re: [Differential] [Accepted] D123: Example Revision`\n".
"| Disable \"Re:\" Prefix | ".
"`[Differential] [Accepted] D123: Example Revision`");
}
public function getSettingDefaultValue() {
return self::VALUE_RE_PREFIX;
}
protected function getSelectOptions() {
return array(
self::VALUE_RE_PREFIX => pht('Enable "Re:" Prefix'),
self::VALUE_NO_PREFIX => pht('Disable "Re:" Prefix'),
);
}
}

View file

@ -0,0 +1,32 @@
<?php
final class PhabricatorEmailSelfActionsSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'self-mail';
const VALUE_SEND_SELF = '0';
const VALUE_NO_SELF = '1';
public function getSettingName() {
return pht('Self Actions');
}
protected function getControlInstructions() {
return pht(
'If you disable **Self Actions**, Phabricator will not notify '.
'you about actions you take.');
}
public function getSettingDefaultValue() {
return self::VALUE_SEND_SELF;
}
protected function getSelectOptions() {
return array(
self::VALUE_SEND_SELF => pht('Enable Self Action Mail'),
self::VALUE_NO_SELF => pht('Disable Self Action Mail'),
);
}
}

View file

@ -0,0 +1,44 @@
<?php
final class PhabricatorEmailVarySubjectsSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'vary-subjects';
const VALUE_VARY_SUBJECTS = 'true';
const VALUE_STATIC_SUBJECTS = 'false';
public function getSettingName() {
return pht('Vary Subjects');
}
protected function getControlInstructions() {
return pht(
'With **Vary Subjects** enabled, most mail subject lines will include '.
'a brief description of their content, like `[Closed]` for a '.
'notification about someone closing a task.'.
"\n\n".
"| Setting | Example Mail Subject\n".
"|----------------------|----------------\n".
"| Vary Subjects | ".
"`[Maniphest] [Closed] T123: Example Task`\n".
"| Do Not Vary Subjects | ".
"`[Maniphest] T123: Example Task`\n".
"\n".
'This can make mail more useful, but some clients have difficulty '.
'threading these messages. Disabling this option may improve '.
'threading at the cost of making subject lines less useful.');
}
public function getSettingDefaultValue() {
return self::VALUE_VARY_SUBJECTS;
}
protected function getSelectOptions() {
return array(
self::VALUE_VARY_SUBJECTS => pht('Enable "Re:" Prefix'),
self::VALUE_STATIC_SUBJECTS => pht('Disable "Re:" Prefix'),
);
}
}

View file

@ -0,0 +1,32 @@
<?php
final class PhabricatorTimeFormatSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'time-format';
const VALUE_FORMAT_12HOUR = 'g:i A';
const VALUE_FORMAT_24HOUR = 'H:i';
public function getSettingName() {
return pht('Time Format');
}
protected function getControlInstructions() {
return pht(
'Select the format you prefer for editing and displaying time.');
}
public function getSettingDefaultValue() {
return self::VALUE_FORMAT_12HOUR;
}
protected function getSelectOptions() {
return array(
self::VALUE_FORMAT_12HOUR => pht('12 Hour, 2:34 PM'),
self::VALUE_FORMAT_24HOUR => pht('24 Hour, 14:34'),
);
}
}

View file

@ -0,0 +1,33 @@
<?php
final class PhabricatorWeekStartDaySetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'week-start-day';
public function getSettingName() {
return pht('Week Starts On');
}
protected function getControlInstructions() {
return pht(
'Choose which day a calendar week should begin on.');
}
public function getSettingDefaultValue() {
return 0;
}
protected function getSelectOptions() {
return array(
0 => pht('Sunday'),
1 => pht('Monday'),
2 => pht('Tuesday'),
3 => pht('Wednesday'),
4 => pht('Thursday'),
5 => pht('Friday'),
6 => pht('Saturday'),
);
}
}