2011-03-31 04:21:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-03-31 04:21:09 +02:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class PhabricatorUserPreferenceSettingsPanelController
|
2011-07-24 20:02:08 +02:00
|
|
|
extends PhabricatorUserSettingsPanelController {
|
2011-03-31 04:21:09 +02:00
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
$preferences = $user->loadPreferences();
|
|
|
|
|
2012-07-27 05:25:27 +02:00
|
|
|
$pref_monospaced = PhabricatorUserPreferences::PREFERENCE_MONOSPACED;
|
|
|
|
$pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR;
|
|
|
|
$pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES;
|
|
|
|
$pref_symbols = PhabricatorUserPreferences::PREFERENCE_DIFFUSION_SYMBOLS;
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
|
2011-03-31 04:21:09 +02:00
|
|
|
if ($request->isFormPost()) {
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
$monospaced = $request->getStr($pref_monospaced);
|
2011-03-31 04:21:09 +02:00
|
|
|
|
|
|
|
// Prevent the user from doing stupid things.
|
|
|
|
$monospaced = preg_replace('/[^a-z0-9 ,"]+/i', '', $monospaced);
|
|
|
|
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
$preferences->setPreference($pref_titles, $request->getStr($pref_titles));
|
2012-01-16 20:08:54 +01:00
|
|
|
$preferences->setPreference($pref_editor, $request->getStr($pref_editor));
|
2012-07-27 05:25:27 +02:00
|
|
|
$preferences->setPreference($pref_symbols,
|
|
|
|
$request->getStr($pref_symbols));
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
$preferences->setPreference($pref_monospaced, $monospaced);
|
2011-03-31 04:21:09 +02:00
|
|
|
|
|
|
|
$preferences->save();
|
|
|
|
return id(new AphrontRedirectResponse())
|
2011-07-24 20:02:08 +02:00
|
|
|
->setURI('/settings/page/preferences/?saved=true');
|
2011-03-31 04:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$example_string = <<<EXAMPLE
|
|
|
|
// This is what your monospaced font currently looks like.
|
|
|
|
function helloWorld() {
|
|
|
|
alert("Hello world!");
|
|
|
|
}
|
|
|
|
EXAMPLE;
|
|
|
|
|
2012-01-31 00:56:42 +01:00
|
|
|
$editor_doc_link = phutil_render_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => PhabricatorEnv::getDoclink(
|
2012-04-10 19:15:40 +02:00
|
|
|
'article/User_Guide_Configuring_an_External_Editor.html'),
|
2012-01-31 00:56:42 +01:00
|
|
|
),
|
|
|
|
'User Guide: Configuring an External Editor');
|
|
|
|
|
2012-07-07 00:39:43 +02:00
|
|
|
$font_default = PhabricatorEnv::getEnvConfig('style.monospace');
|
|
|
|
$font_default = phutil_escape_html($font_default);
|
|
|
|
|
2011-03-31 04:21:09 +02:00
|
|
|
$form = id(new AphrontFormView())
|
|
|
|
->setUser($user)
|
2011-07-24 20:02:08 +02:00
|
|
|
->setAction('/settings/page/preferences/')
|
2011-03-31 04:21:09 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSelectControl())
|
|
|
|
->setLabel('Page Titles')
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
->setName($pref_titles)
|
|
|
|
->setValue($preferences->getPreference($pref_titles))
|
2011-03-31 04:21:09 +02:00
|
|
|
->setOptions(
|
|
|
|
array(
|
|
|
|
'glyph' =>
|
|
|
|
"In page titles, show Tool names as unicode glyphs: \xE2\x9A\x99",
|
|
|
|
'text' =>
|
|
|
|
'In page titles, show Tool names as plain text: [Differential]',
|
|
|
|
)))
|
2012-01-16 20:08:54 +01:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
|
|
|
->setLabel('Editor Link')
|
|
|
|
->setName($pref_editor)
|
|
|
|
->setCaption(
|
|
|
|
'Link to edit files in external editor. '.
|
2012-01-31 00:56:42 +01:00
|
|
|
'%f is replaced by filename, %l by line number, %r by repository '.
|
2012-04-10 09:55:31 +02:00
|
|
|
'callsign, %% by literal %. '.
|
2012-01-31 00:56:42 +01:00
|
|
|
"For documentation, see {$editor_doc_link}.")
|
2012-01-16 20:08:54 +01:00
|
|
|
->setValue($preferences->getPreference($pref_editor)))
|
2011-03-31 04:21:09 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
|
|
|
->setLabel('Monospaced Font')
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
->setName($pref_monospaced)
|
2011-03-31 04:21:09 +02:00
|
|
|
->setCaption(
|
|
|
|
'Overrides default fonts in tools like Differential. '.
|
2012-07-07 00:39:43 +02:00
|
|
|
'(Default: '.$font_default.')')
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
->setValue($preferences->getPreference($pref_monospaced)))
|
2011-03-31 04:21:09 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormMarkupControl())
|
|
|
|
->setValue(
|
|
|
|
'<pre class="PhabricatorMonospaced">'.
|
|
|
|
phutil_escape_html($example_string).
|
|
|
|
'</pre>'))
|
2012-07-27 05:25:27 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormRadioButtonControl())
|
|
|
|
->setLabel('Symbol Links')
|
|
|
|
->setName($pref_symbols)
|
|
|
|
->setValue($preferences->getPreference($pref_symbols) ?: 'enabled')
|
|
|
|
->addButton('enabled', 'Enabled (default)',
|
|
|
|
'Use this setting to disable linking symbol names in Differential '.
|
|
|
|
'and Diffusion to their definitions. This is enabled by default.')
|
|
|
|
->addButton('disabled', 'Disabled', null))
|
2011-03-31 04:21:09 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
|
|
|
->setValue('Save Preferences'));
|
|
|
|
|
|
|
|
$panel = new AphrontPanelView();
|
2011-04-01 01:06:51 +02:00
|
|
|
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
|
Add optional "Re:" prefix to all threaded mail and allow disabling mail about
your own actions
Summary:
- Mail.app on Lion has cumbersome threading rules, see T782. Add an option to
stick "Re: " in front of all threaded mail so it behaves. This is horrible, but
apparently the least-horrible option.
- While I was in there, I added an option for T228.
Test Plan:
- Sent a bunch of threaded and unthreaded mail with varous "Re:" settings,
seemed to get "Re:" in the right places.
- Disabled email about my stuff, created a task with just me, got voided mail,
added a CC, got mail to just the CC.
Reviewers: btrahan, jungejason
Reviewed By: btrahan
CC: aran, mkjones
Maniphest Tasks: T228, T782
Differential Revision: https://secure.phabricator.com/D1448
2012-01-18 05:32:28 +01:00
|
|
|
$panel->setHeader('Display Preferences');
|
2011-03-31 04:21:09 +02:00
|
|
|
$panel->appendChild($form);
|
|
|
|
|
|
|
|
$error_view = null;
|
|
|
|
if ($request->getStr('saved') === 'true') {
|
|
|
|
$error_view = id(new AphrontErrorView())
|
|
|
|
->setTitle('Preferences Saved')
|
|
|
|
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
|
|
|
->setErrors(array('Your preferences have been saved.'));
|
|
|
|
}
|
|
|
|
|
2011-07-24 20:02:08 +02:00
|
|
|
return id(new AphrontNullView())
|
|
|
|
->appendChild(
|
|
|
|
array(
|
|
|
|
$error_view,
|
|
|
|
$panel,
|
|
|
|
));
|
2011-03-31 04:21:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|