mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
Separate email formatting options into a new panel
Summary: Ref T5861. These two options are complex, rarely useful, and not directly related to controlling what mail you receive. Move them to a separate panel to make way for more stuff on the preferences panel. We'll probably add an "HTML" option to this new panel eventually, too. Test Plan: {F189474} - Used both panels. - Tested with multiplexing off. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T5861 Differential Revision: https://secure.phabricator.com/D10236
This commit is contained in:
parent
500506bfef
commit
0196f53f9d
3 changed files with 184 additions and 89 deletions
|
@ -2146,6 +2146,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorSettingsPanelDiffPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelDiffPreferences.php',
|
'PhabricatorSettingsPanelDiffPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelDiffPreferences.php',
|
||||||
'PhabricatorSettingsPanelDisplayPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php',
|
'PhabricatorSettingsPanelDisplayPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php',
|
||||||
'PhabricatorSettingsPanelEmailAddresses' => 'applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php',
|
'PhabricatorSettingsPanelEmailAddresses' => 'applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php',
|
||||||
|
'PhabricatorSettingsPanelEmailFormat' => 'applications/settings/panel/PhabricatorSettingsPanelEmailFormat.php',
|
||||||
'PhabricatorSettingsPanelEmailPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php',
|
'PhabricatorSettingsPanelEmailPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php',
|
||||||
'PhabricatorSettingsPanelExternalAccounts' => 'applications/settings/panel/PhabricatorSettingsPanelExternalAccounts.php',
|
'PhabricatorSettingsPanelExternalAccounts' => 'applications/settings/panel/PhabricatorSettingsPanelExternalAccounts.php',
|
||||||
'PhabricatorSettingsPanelHomePreferences' => 'applications/settings/panel/PhabricatorSettingsPanelHomePreferences.php',
|
'PhabricatorSettingsPanelHomePreferences' => 'applications/settings/panel/PhabricatorSettingsPanelHomePreferences.php',
|
||||||
|
@ -5018,6 +5019,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorSettingsPanelDiffPreferences' => 'PhabricatorSettingsPanel',
|
'PhabricatorSettingsPanelDiffPreferences' => 'PhabricatorSettingsPanel',
|
||||||
'PhabricatorSettingsPanelDisplayPreferences' => 'PhabricatorSettingsPanel',
|
'PhabricatorSettingsPanelDisplayPreferences' => 'PhabricatorSettingsPanel',
|
||||||
'PhabricatorSettingsPanelEmailAddresses' => 'PhabricatorSettingsPanel',
|
'PhabricatorSettingsPanelEmailAddresses' => 'PhabricatorSettingsPanel',
|
||||||
|
'PhabricatorSettingsPanelEmailFormat' => 'PhabricatorSettingsPanel',
|
||||||
'PhabricatorSettingsPanelEmailPreferences' => 'PhabricatorSettingsPanel',
|
'PhabricatorSettingsPanelEmailPreferences' => 'PhabricatorSettingsPanel',
|
||||||
'PhabricatorSettingsPanelExternalAccounts' => 'PhabricatorSettingsPanel',
|
'PhabricatorSettingsPanelExternalAccounts' => 'PhabricatorSettingsPanel',
|
||||||
'PhabricatorSettingsPanelHomePreferences' => 'PhabricatorSettingsPanel',
|
'PhabricatorSettingsPanelHomePreferences' => 'PhabricatorSettingsPanel',
|
||||||
|
|
|
@ -0,0 +1,182 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorSettingsPanelEmailFormat
|
||||||
|
extends PhabricatorSettingsPanel {
|
||||||
|
|
||||||
|
public function getPanelKey() {
|
||||||
|
return 'emailformat';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPanelName() {
|
||||||
|
return pht('Email Format');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPanelGroup() {
|
||||||
|
return pht('Email');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processRequest(AphrontRequest $request) {
|
||||||
|
$user = $request->getUser();
|
||||||
|
|
||||||
|
$preferences = $user->loadPreferences();
|
||||||
|
|
||||||
|
$pref_re_prefix = PhabricatorUserPreferences::PREFERENCE_RE_PREFIX;
|
||||||
|
$pref_vary = PhabricatorUserPreferences::PREFERENCE_VARY_SUBJECT;
|
||||||
|
|
||||||
|
$errors = array();
|
||||||
|
if ($request->isFormPost()) {
|
||||||
|
|
||||||
|
if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) {
|
||||||
|
if ($request->getStr($pref_re_prefix) == 'default') {
|
||||||
|
$preferences->unsetPreference($pref_re_prefix);
|
||||||
|
} else {
|
||||||
|
$preferences->setPreference(
|
||||||
|
$pref_re_prefix,
|
||||||
|
$request->getBool($pref_re_prefix));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->getStr($pref_vary) == 'default') {
|
||||||
|
$preferences->unsetPreference($pref_vary);
|
||||||
|
} else {
|
||||||
|
$preferences->setPreference(
|
||||||
|
$pref_vary,
|
||||||
|
$request->getBool($pref_vary));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$preferences->save();
|
||||||
|
|
||||||
|
return id(new AphrontRedirectResponse())
|
||||||
|
->setURI($this->getPanelURI('?saved=true'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$re_prefix_default = PhabricatorEnv::getEnvConfig('metamta.re-prefix')
|
||||||
|
? pht('Enabled')
|
||||||
|
: pht('Disabled');
|
||||||
|
|
||||||
|
$vary_default = PhabricatorEnv::getEnvConfig('metamta.vary-subjects')
|
||||||
|
? pht('Vary')
|
||||||
|
: pht('Do Not Vary');
|
||||||
|
|
||||||
|
$re_prefix_value = $preferences->getPreference($pref_re_prefix);
|
||||||
|
if ($re_prefix_value === null) {
|
||||||
|
$re_prefix_value = 'default';
|
||||||
|
} else {
|
||||||
|
$re_prefix_value = $re_prefix_value
|
||||||
|
? 'true'
|
||||||
|
: 'false';
|
||||||
|
}
|
||||||
|
|
||||||
|
$vary_value = $preferences->getPreference($pref_vary);
|
||||||
|
if ($vary_value === null) {
|
||||||
|
$vary_value = 'default';
|
||||||
|
} else {
|
||||||
|
$vary_value = $vary_value
|
||||||
|
? 'true'
|
||||||
|
: 'false';
|
||||||
|
}
|
||||||
|
|
||||||
|
$form = new AphrontFormView();
|
||||||
|
$form
|
||||||
|
->setUser($user);
|
||||||
|
|
||||||
|
if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) {
|
||||||
|
$re_control = id(new AphrontFormSelectControl())
|
||||||
|
->setName($pref_re_prefix)
|
||||||
|
->setOptions(
|
||||||
|
array(
|
||||||
|
'default' => pht('Use Server Default (%s)', $re_prefix_default),
|
||||||
|
'true' => pht('Enable "Re:" prefix'),
|
||||||
|
'false' => pht('Disable "Re:" prefix'),
|
||||||
|
))
|
||||||
|
->setValue($re_prefix_value);
|
||||||
|
|
||||||
|
$vary_control = id(new AphrontFormSelectControl())
|
||||||
|
->setName($pref_vary)
|
||||||
|
->setOptions(
|
||||||
|
array(
|
||||||
|
'default' => pht('Use Server Default (%s)', $vary_default),
|
||||||
|
'true' => pht('Vary Subjects'),
|
||||||
|
'false' => pht('Do Not Vary Subjects'),
|
||||||
|
))
|
||||||
|
->setValue($vary_value);
|
||||||
|
} else {
|
||||||
|
$re_control = id(new AphrontFormStaticControl())
|
||||||
|
->setValue('Server Default ('.$re_prefix_default.')');
|
||||||
|
|
||||||
|
$vary_control = id(new AphrontFormStaticControl())
|
||||||
|
->setValue('Server Default ('.$vary_default.')');
|
||||||
|
}
|
||||||
|
|
||||||
|
$form
|
||||||
|
->appendRemarkupInstructions(
|
||||||
|
pht(
|
||||||
|
'These settings fine-tune some technical aspects of how email is '.
|
||||||
|
'formatted. You may be able to adjust them to make mail more '.
|
||||||
|
'useful or improve threading.'));
|
||||||
|
|
||||||
|
if (!PhabricatorMetaMTAMail::shouldMultiplexAllMail()) {
|
||||||
|
$form->appendRemarkupInstructions(
|
||||||
|
pht(
|
||||||
|
'NOTE: This install of Phabricator is configured to send a '.
|
||||||
|
'single mail message to all recipients, so all settings are '.
|
||||||
|
'locked at the server default value.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$form
|
||||||
|
->appendRemarkupInstructions('')
|
||||||
|
->appendRemarkupInstructions(
|
||||||
|
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`"))
|
||||||
|
->appendChild(
|
||||||
|
$re_control
|
||||||
|
->setLabel(pht('Add "Re:" Prefix')))
|
||||||
|
->appendRemarkupInstructions('')
|
||||||
|
->appendRemarkupInstructions(
|
||||||
|
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 less useful subject lines.'))
|
||||||
|
->appendChild(
|
||||||
|
$vary_control
|
||||||
|
->setLabel(pht('Vary Subjects')));
|
||||||
|
|
||||||
|
$form
|
||||||
|
->appendChild(
|
||||||
|
id(new AphrontFormSubmitControl())
|
||||||
|
->setValue(pht('Save Preferences')));
|
||||||
|
|
||||||
|
$form_box = id(new PHUIObjectBoxView())
|
||||||
|
->setHeaderText(pht('Email Format'))
|
||||||
|
->setFormSaved($request->getStr('saved'))
|
||||||
|
->setFormErrors($errors)
|
||||||
|
->setForm($form);
|
||||||
|
|
||||||
|
return id(new AphrontNullView())
|
||||||
|
->appendChild(
|
||||||
|
array(
|
||||||
|
$form_box,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -20,31 +20,10 @@ final class PhabricatorSettingsPanelEmailPreferences
|
||||||
|
|
||||||
$preferences = $user->loadPreferences();
|
$preferences = $user->loadPreferences();
|
||||||
|
|
||||||
$pref_re_prefix = PhabricatorUserPreferences::PREFERENCE_RE_PREFIX;
|
|
||||||
$pref_vary = PhabricatorUserPreferences::PREFERENCE_VARY_SUBJECT;
|
|
||||||
$pref_no_self_mail = PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL;
|
$pref_no_self_mail = PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
|
|
||||||
if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) {
|
|
||||||
if ($request->getStr($pref_re_prefix) == 'default') {
|
|
||||||
$preferences->unsetPreference($pref_re_prefix);
|
|
||||||
} else {
|
|
||||||
$preferences->setPreference(
|
|
||||||
$pref_re_prefix,
|
|
||||||
$request->getBool($pref_re_prefix));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->getStr($pref_vary) == 'default') {
|
|
||||||
$preferences->unsetPreference($pref_vary);
|
|
||||||
} else {
|
|
||||||
$preferences->setPreference(
|
|
||||||
$pref_vary,
|
|
||||||
$request->getBool($pref_vary));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$preferences->setPreference(
|
$preferences->setPreference(
|
||||||
$pref_no_self_mail,
|
$pref_no_self_mail,
|
||||||
$request->getStr($pref_no_self_mail));
|
$request->getStr($pref_no_self_mail));
|
||||||
|
@ -74,32 +53,6 @@ final class PhabricatorSettingsPanelEmailPreferences
|
||||||
->setURI($this->getPanelURI('?saved=true'));
|
->setURI($this->getPanelURI('?saved=true'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$re_prefix_default = PhabricatorEnv::getEnvConfig('metamta.re-prefix')
|
|
||||||
? pht('Enabled')
|
|
||||||
: pht('Disabled');
|
|
||||||
|
|
||||||
$vary_default = PhabricatorEnv::getEnvConfig('metamta.vary-subjects')
|
|
||||||
? pht('Vary')
|
|
||||||
: pht('Do Not Vary');
|
|
||||||
|
|
||||||
$re_prefix_value = $preferences->getPreference($pref_re_prefix);
|
|
||||||
if ($re_prefix_value === null) {
|
|
||||||
$re_prefix_value = 'default';
|
|
||||||
} else {
|
|
||||||
$re_prefix_value = $re_prefix_value
|
|
||||||
? 'true'
|
|
||||||
: 'false';
|
|
||||||
}
|
|
||||||
|
|
||||||
$vary_value = $preferences->getPreference($pref_vary);
|
|
||||||
if ($vary_value === null) {
|
|
||||||
$vary_value = 'default';
|
|
||||||
} else {
|
|
||||||
$vary_value = $vary_value
|
|
||||||
? 'true'
|
|
||||||
: 'false';
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = new AphrontFormView();
|
$form = new AphrontFormView();
|
||||||
$form
|
$form
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
@ -115,48 +68,6 @@ final class PhabricatorSettingsPanelEmailPreferences
|
||||||
->setCaption(pht('You can disable email about your own actions.'))
|
->setCaption(pht('You can disable email about your own actions.'))
|
||||||
->setValue($preferences->getPreference($pref_no_self_mail, 0)));
|
->setValue($preferences->getPreference($pref_no_self_mail, 0)));
|
||||||
|
|
||||||
if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) {
|
|
||||||
$re_control = id(new AphrontFormSelectControl())
|
|
||||||
->setName($pref_re_prefix)
|
|
||||||
->setOptions(
|
|
||||||
array(
|
|
||||||
'default' => pht('Use Server Default (%s)', $re_prefix_default),
|
|
||||||
'true' => pht('Enable "Re:" prefix'),
|
|
||||||
'false' => pht('Disable "Re:" prefix'),
|
|
||||||
))
|
|
||||||
->setValue($re_prefix_value);
|
|
||||||
|
|
||||||
$vary_control = id(new AphrontFormSelectControl())
|
|
||||||
->setName($pref_vary)
|
|
||||||
->setOptions(
|
|
||||||
array(
|
|
||||||
'default' => pht('Use Server Default (%s)', $vary_default),
|
|
||||||
'true' => pht('Vary Subjects'),
|
|
||||||
'false' => pht('Do Not Vary Subjects'),
|
|
||||||
))
|
|
||||||
->setValue($vary_value);
|
|
||||||
} else {
|
|
||||||
$re_control = id(new AphrontFormStaticControl())
|
|
||||||
->setValue('Server Default ('.$re_prefix_default.')');
|
|
||||||
|
|
||||||
$vary_control = id(new AphrontFormStaticControl())
|
|
||||||
->setValue('Server Default ('.$vary_default.')');
|
|
||||||
}
|
|
||||||
|
|
||||||
$form
|
|
||||||
->appendChild(
|
|
||||||
$re_control
|
|
||||||
->setLabel(pht('Add "Re:" Prefix'))
|
|
||||||
->setCaption(
|
|
||||||
pht('Enable this option to fix threading in Mail.app on OS X Lion,'.
|
|
||||||
' or if you like "Re:" in your email subjects.')))
|
|
||||||
->appendChild(
|
|
||||||
$vary_control
|
|
||||||
->setLabel(pht('Vary Subjects'))
|
|
||||||
->setCaption(
|
|
||||||
pht('This option adds more information to email subjects, but may '.
|
|
||||||
'break threading in some clients.')));
|
|
||||||
|
|
||||||
$mailtags = $preferences->getPreference('mailtags', array());
|
$mailtags = $preferences->getPreference('mailtags', array());
|
||||||
|
|
||||||
$form->appendChild(
|
$form->appendChild(
|
||||||
|
|
Loading…
Reference in a new issue