mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
Provide user option for disabling diffusion symbol cross-references
Summary: Some people don't like these, so they should be able to turn them off. Test Plan: Toggled the setting on and off; loaded a page in diffusion and differential that should have symbol cross-references, and saw that they weren't linked when I had the setting disabled. I also checked that the symbols are still linked when the setting hasn't been touched. Reviewers: epriestley, vrana Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3069
This commit is contained in:
parent
0cfdf2f74f
commit
14e3e5ccfd
4 changed files with 36 additions and 15 deletions
|
@ -132,9 +132,14 @@ final class DifferentialChangesetListView extends AphrontView {
|
|||
$ref,
|
||||
$changeset);
|
||||
|
||||
$prefs = $this->user->loadPreferences();
|
||||
$pref_symbols = $prefs->getPreference(
|
||||
PhabricatorUserPreferences::PREFERENCE_DIFFUSION_SYMBOLS);
|
||||
$detail->setChangeset($changeset);
|
||||
$detail->addButton($view_options);
|
||||
$detail->setSymbolIndex(idx($this->symbolIndexes, $key));
|
||||
if ($pref_symbols != 'disabled') {
|
||||
$detail->setSymbolIndex(idx($this->symbolIndexes, $key));
|
||||
}
|
||||
$detail->setVsChangesetID(idx($this->vsMap, $changeset->getID()));
|
||||
$detail->setEditable(true);
|
||||
|
||||
|
|
|
@ -231,7 +231,10 @@ final class DiffusionBrowseFileController extends DiffusionController {
|
|||
|
||||
$lang = last(explode('.', $drequest->getPath()));
|
||||
|
||||
if (isset($langs[$lang])) {
|
||||
$prefs = $this->getRequest()->getUser()->loadPreferences();
|
||||
$pref_symbols = $prefs->getPreference(
|
||||
PhabricatorUserPreferences::PREFERENCE_DIFFUSION_SYMBOLS);
|
||||
if (isset($langs[$lang]) && $pref_symbols != 'disabled') {
|
||||
Javelin::initBehavior(
|
||||
'repository-crossreference',
|
||||
array(
|
||||
|
|
|
@ -25,9 +25,10 @@ final class PhabricatorUserPreferenceSettingsPanelController
|
|||
$user = $request->getUser();
|
||||
$preferences = $user->loadPreferences();
|
||||
|
||||
$pref_monospaced = PhabricatorUserPreferences::PREFERENCE_MONOSPACED;
|
||||
$pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR;
|
||||
$pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES;
|
||||
$pref_monospaced = PhabricatorUserPreferences::PREFERENCE_MONOSPACED;
|
||||
$pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR;
|
||||
$pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES;
|
||||
$pref_symbols = PhabricatorUserPreferences::PREFERENCE_DIFFUSION_SYMBOLS;
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$monospaced = $request->getStr($pref_monospaced);
|
||||
|
@ -37,6 +38,8 @@ final class PhabricatorUserPreferenceSettingsPanelController
|
|||
|
||||
$preferences->setPreference($pref_titles, $request->getStr($pref_titles));
|
||||
$preferences->setPreference($pref_editor, $request->getStr($pref_editor));
|
||||
$preferences->setPreference($pref_symbols,
|
||||
$request->getStr($pref_symbols));
|
||||
$preferences->setPreference($pref_monospaced, $monospaced);
|
||||
|
||||
$preferences->save();
|
||||
|
@ -101,6 +104,15 @@ EXAMPLE;
|
|||
'<pre class="PhabricatorMonospaced">'.
|
||||
phutil_escape_html($example_string).
|
||||
'</pre>'))
|
||||
->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))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Save Preferences'));
|
||||
|
|
|
@ -18,19 +18,20 @@
|
|||
|
||||
final class PhabricatorUserPreferences extends PhabricatorUserDAO {
|
||||
|
||||
const PREFERENCE_MONOSPACED = 'monospaced';
|
||||
const PREFERENCE_EDITOR = 'editor';
|
||||
const PREFERENCE_TITLES = 'titles';
|
||||
const PREFERENCE_MONOSPACED = 'monospaced';
|
||||
const PREFERENCE_EDITOR = 'editor';
|
||||
const PREFERENCE_TITLES = 'titles';
|
||||
|
||||
const PREFERENCE_RE_PREFIX = 're-prefix';
|
||||
const PREFERENCE_NO_SELF_MAIL = 'self-mail';
|
||||
const PREFERENCE_MAILTAGS = 'mailtags';
|
||||
const PREFERENCE_VARY_SUBJECT = 'vary-subject';
|
||||
const PREFERENCE_RE_PREFIX = 're-prefix';
|
||||
const PREFERENCE_NO_SELF_MAIL = 'self-mail';
|
||||
const PREFERENCE_MAILTAGS = 'mailtags';
|
||||
const PREFERENCE_VARY_SUBJECT = 'vary-subject';
|
||||
|
||||
const PREFERENCE_SEARCHBAR_JUMP = 'searchbar-jump';
|
||||
const PREFERENCE_SEARCH_SHORTCUT = 'search-shortcut';
|
||||
const PREFERENCE_SEARCHBAR_JUMP = 'searchbar-jump';
|
||||
const PREFERENCE_SEARCH_SHORTCUT = 'search-shortcut';
|
||||
|
||||
const PREFERENCE_DIFFUSION_VIEW = 'diffusion-view';
|
||||
const PREFERENCE_DIFFUSION_VIEW = 'diffusion-view';
|
||||
const PREFERENCE_DIFFUSION_SYMBOLS = 'diffusion-symbols';
|
||||
|
||||
protected $userPHID;
|
||||
protected $preferences = array();
|
||||
|
|
Loading…
Reference in a new issue