@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Created a preference pane for DarkConsole, instead of link

Summary: Just removed the link and created a new field under preferences. Now the setting is under Display Preferences.

Test Plan: Enablied/Disabled dark console to see if it works.

Reviewers: epriestley

Reviewed By: epriestley

CC: irinav, aran, Korvin

Maniphest Tasks: T2344

Differential Revision: https://secure.phabricator.com/D4549

Conflicts:

src/view/page/PhabricatorStandardPageView.php

authored by

Andrei Antonescu and committed by
epriestley
f919f000 49679a6b

+33 -42
+1 -13
src/aphront/console/DarkConsoleController.php
··· 26 26 return id(new AphrontAjaxResponse())->setDisableConsole(true); 27 27 } 28 28 29 - if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) { 30 - $user->setConsoleEnabled(!$user->getConsoleEnabled()); 31 - if ($user->getConsoleEnabled()) { 32 - $user->setConsoleVisible(true); 33 - } 34 - $user->save(); 35 - if ($request->isAjax()) { 36 - return new AphrontRedirectResponse(); 37 - } else { 38 - return id(new AphrontRedirectResponse())->setURI('/'); 39 - } 40 - } 41 - 29 + return new Aphront404Response(); 42 30 } 43 31 44 32 }
+5 -2
src/applications/base/controller/PhabricatorController.php
··· 88 88 return $this->delegateToController($checker_controller); 89 89 } 90 90 91 + $preferences = $user->loadPreferences(); 92 + 91 93 if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) { 92 - if ($user->getConsoleEnabled() || 93 - PhabricatorEnv::getEnvConfig('darkconsole.always-on')) { 94 + $dark_console = PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE; 95 + if ($preferences->getPreference($dark_console) || 96 + PhabricatorEnv::getEnvConfig('darkconsole.always-on')) { 94 97 $console = new DarkConsoleCore(); 95 98 $request->getApplicationConfiguration()->setConsole($console); 96 99 }
+2 -1
src/applications/people/storage/PhabricatorUser.php
··· 440 440 $default_dict = array( 441 441 PhabricatorUserPreferences::PREFERENCE_TITLES => 'glyph', 442 442 PhabricatorUserPreferences::PREFERENCE_EDITOR => '', 443 - PhabricatorUserPreferences::PREFERENCE_MONOSPACED => ''); 443 + PhabricatorUserPreferences::PREFERENCE_MONOSPACED => '', 444 + PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE => 0); 444 445 445 446 $preferences->setPreferences($default_dict); 446 447 }
+24 -5
src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php
··· 19 19 $user = $request->getUser(); 20 20 $preferences = $user->loadPreferences(); 21 21 22 - $pref_monospaced = PhabricatorUserPreferences::PREFERENCE_MONOSPACED; 23 - $pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR; 24 - $pref_multiedit = PhabricatorUserPreferences::PREFERENCE_MULTIEDIT; 25 - $pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES; 26 - $pref_symbols = PhabricatorUserPreferences::PREFERENCE_DIFFUSION_SYMBOLS; 22 + $pref_monospaced = PhabricatorUserPreferences::PREFERENCE_MONOSPACED; 23 + $pref_dark_console = PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE; 24 + $pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR; 25 + $pref_multiedit = PhabricatorUserPreferences::PREFERENCE_MULTIEDIT; 26 + $pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES; 27 + $pref_symbols = 28 + PhabricatorUserPreferences::PREFERENCE_DIFFUSION_SYMBOLS; 27 29 $pref_monospaced_textareas = 28 30 PhabricatorUserPreferences::PREFERENCE_MONOSPACED_TEXTAREAS; 29 31 ··· 45 47 $preferences->setPreference( 46 48 $pref_monospaced_textareas, 47 49 $request->getStr($pref_monospaced_textareas)); 50 + $preferences->setPreference( 51 + $pref_dark_console, 52 + $request->getBool($pref_dark_console)); 48 53 49 54 $preferences->save(); 50 55 return id(new AphrontRedirectResponse()) ··· 75 80 if (!$pref_monospaced_textareas_value) { 76 81 $pref_monospaced_textareas_value = 'disabled'; 77 82 } 83 + $pref_dark_console_value = $preferences->getPreference($pref_dark_console); 84 + if (!$pref_dark_console_value) { 85 + $pref_dark_console_value = 0; 86 + } 78 87 79 88 $form = id(new AphrontFormView()) 80 89 ->setUser($user) ··· 141 150 'Show all textareas using the monospaced font defined above.') 142 151 ->addButton('disabled', 'Disabled', null)) 143 152 ->appendChild( 153 + id(new AphrontFormRadioButtonControl()) 154 + ->setLabel('Dark Console') 155 + ->setName($pref_dark_console) 156 + ->setValue($pref_dark_console_value ? 157 + $pref_dark_console_value : 0) 158 + ->addButton(1, 'Enabled', 159 + 'Enabling and using the built-in debugging console.') 160 + ->addButton(0, 'Disabled', null)) 161 + ->appendChild( 144 162 id(new AphrontFormSubmitControl()) 145 163 ->setValue('Save Preferences')); 164 + 146 165 147 166 $panel = new AphrontPanelView(); 148 167 $panel->setHeader('Display Preferences');
+1
src/applications/settings/storage/PhabricatorUserPreferences.php
··· 3 3 final class PhabricatorUserPreferences extends PhabricatorUserDAO { 4 4 5 5 const PREFERENCE_MONOSPACED = 'monospaced'; 6 + const PREFERENCE_DARK_CONSOLE = 'dark_console'; 6 7 const PREFERENCE_EDITOR = 'editor'; 7 8 const PREFERENCE_MULTIEDIT = 'multiedit'; 8 9 const PREFERENCE_TITLES = 'titles';
-21
src/view/page/PhabricatorStandardPageView.php
··· 370 370 371 371 $foot_links = array(); 372 372 373 - if (PhabricatorEnv::getEnvConfig('darkconsole.enabled') && 374 - !PhabricatorEnv::getEnvConfig('darkconsole.always-on')) { 375 - if ($console) { 376 - $link = javelin_render_tag( 377 - 'a', 378 - array( 379 - 'href' => '/~/', 380 - 'sigil' => 'workflow', 381 - ), 382 - 'Disable DarkConsole'); 383 - } else { 384 - $link = javelin_render_tag( 385 - 'a', 386 - array( 387 - 'href' => '/~/', 388 - 'sigil' => 'workflow', 389 - ), 390 - 'Enable DarkConsole'); 391 - } 392 - $foot_links[] = $link; 393 - } 394 373 395 374 $foot_links = implode(' · ', $foot_links); 396 375