@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.

Make durable column sticky across requests

Summary: When you open the column, keep it open on future requests.

Test Plan: Opened column, clicked to Conpherence (no column), clicked elsewhere (column again), reloaded page (column), closed column, clicked something (no column).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

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

+97 -34
+13 -13
resources/celerity/map.php
··· 44 44 'rsrc/css/application/config/config-welcome.css' => '6abd79be', 45 45 'rsrc/css/application/config/setup-issue.css' => '22270af2', 46 46 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', 47 - 'rsrc/css/application/conpherence/durable-column.css' => '9207426d', 47 + 'rsrc/css/application/conpherence/durable-column.css' => '7abcc3f2', 48 48 'rsrc/css/application/conpherence/menu.css' => 'c6ac5299', 49 49 'rsrc/css/application/conpherence/message-pane.css' => '5930260a', 50 50 'rsrc/css/application/conpherence/notification.css' => '04a6e10a', ··· 353 353 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 354 354 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', 355 355 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'efef202b', 356 - 'rsrc/js/application/conpherence/behavior-durable-column.js' => '1eef9f26', 356 + 'rsrc/js/application/conpherence/behavior-durable-column.js' => 'aa3b6c22', 357 357 'rsrc/js/application/conpherence/behavior-menu.js' => 'e476c952', 358 358 'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861', 359 359 'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3', ··· 515 515 'changeset-view-manager' => '88be0133', 516 516 'config-options-css' => '7fedf08b', 517 517 'config-welcome-css' => '6abd79be', 518 - 'conpherence-durable-column-view' => '9207426d', 518 + 'conpherence-durable-column-view' => '7abcc3f2', 519 519 'conpherence-menu-css' => 'c6ac5299', 520 520 'conpherence-message-pane-css' => '5930260a', 521 521 'conpherence-notification-css' => '04a6e10a', ··· 586 586 'javelin-behavior-diffusion-locate-file' => '6d3e1947', 587 587 'javelin-behavior-diffusion-pull-lastmodified' => '2b228192', 588 588 'javelin-behavior-doorkeeper-tag' => 'e5822781', 589 - 'javelin-behavior-durable-column' => '1eef9f26', 589 + 'javelin-behavior-durable-column' => 'aa3b6c22', 590 590 'javelin-behavior-error-log' => '6882e80a', 591 591 'javelin-behavior-fancy-datepicker' => 'c51ae228', 592 592 'javelin-behavior-global-drag-and-drop' => '07f199d8', ··· 956 956 'javelin-dom', 957 957 'javelin-reactor-dom', 958 958 ), 959 - '1eef9f26' => array( 960 - 'javelin-behavior', 961 - 'javelin-dom', 962 - 'javelin-stratcom', 963 - 'javelin-scrollbar', 964 - 'javelin-quicksand', 965 - 'phabricator-keyboard-shortcut', 966 - 'conpherence-thread-manager', 967 - ), 968 959 '1feea462' => array( 969 960 'javelin-install', 970 961 'javelin-dom', ··· 1665 1656 'javelin-dom', 1666 1657 'javelin-util', 1667 1658 'phabricator-prefab', 1659 + ), 1660 + 'aa3b6c22' => array( 1661 + 'javelin-behavior', 1662 + 'javelin-dom', 1663 + 'javelin-stratcom', 1664 + 'javelin-scrollbar', 1665 + 'javelin-quicksand', 1666 + 'phabricator-keyboard-shortcut', 1667 + 'conpherence-thread-manager', 1668 1668 ), 1669 1669 'b1f0ccee' => array( 1670 1670 'javelin-install',
+26 -1
src/applications/conpherence/view/ConpherenceDurableColumnView.php
··· 5 5 private $conpherences; 6 6 private $selectedConpherence; 7 7 private $transactions; 8 + private $visible; 8 9 9 10 public function setConpherences(array $conpherences) { 10 11 assert_instances_of($conpherences, 'ConpherenceThread'); ··· 36 37 return $this->transactions; 37 38 } 38 39 40 + public function setVisible($visible) { 41 + $this->visible = $visible; 42 + return $this; 43 + } 44 + 45 + public function getVisible() { 46 + return $this->visible; 47 + } 48 + 39 49 protected function getTagAttributes() { 50 + if ($this->getVisible()) { 51 + $style = null; 52 + } else { 53 + $style = 'display: none;'; 54 + } 55 + 40 56 return array( 41 57 'id' => 'conpherence-durable-column', 42 58 'class' => 'conpherence-durable-column', 43 - 'style' => 'display: none;', 59 + 'style' => $style, 44 60 'sigil' => 'conpherence-durable-column', 45 61 ); 46 62 } 47 63 48 64 protected function getTagContent() { 65 + $column_key = PhabricatorUserPreferences::PREFERENCE_CONPHERENCE_COLUMN; 66 + 67 + Javelin::initBehavior( 68 + 'durable-column', 69 + array( 70 + 'visible' => $this->getVisible(), 71 + 'settingsURI' => '/settings/adjust/?key='.$column_key, 72 + )); 73 + 49 74 $classes = array(); 50 75 $classes[] = 'conpherence-durable-column-header'; 51 76 $classes[] = 'sprite-main-header';
+2 -1
src/applications/settings/storage/PhabricatorUserPreferences.php
··· 31 31 const PREFERENCE_DIFF_UNIFIED = 'diff-unified'; 32 32 const PREFERENCE_DIFF_FILETREE = 'diff-filetree'; 33 33 34 - const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications'; 34 + const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications'; 35 + const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column'; 35 36 36 37 // These are in an unusual order for historic reasons. 37 38 const MAILTAG_PREFERENCE_NOTIFY = 0;
+28 -13
src/view/page/PhabricatorStandardPageView.php
··· 108 108 return true; 109 109 } 110 110 111 - public function getTitle() { 112 - $use_glyph = true; 111 + public function getDurableColumnVisible() { 112 + $column_key = PhabricatorUserPreferences::PREFERENCE_CONPHERENCE_COLUMN; 113 + return (bool)$this->getUserPreference($column_key, 0); 114 + } 113 115 114 - $request = $this->getRequest(); 115 - if ($request) { 116 - $user = $request->getUser(); 117 - if ($user && $user->loadPreferences()->getPreference( 118 - PhabricatorUserPreferences::PREFERENCE_TITLES) !== 'glyph') { 119 - $use_glyph = false; 120 - } 116 + 117 + public function getTitle() { 118 + $glyph_key = PhabricatorUserPreferences::PREFERENCE_TITLES; 119 + if ($this->getUserPreference($glyph_key) == 'text') { 120 + $use_glyph = false; 121 + } else { 122 + $use_glyph = true; 121 123 } 122 124 123 125 $title = parent::getTitle(); ··· 416 418 417 419 $durable_column = null; 418 420 if ($this->getShowDurableColumn()) { 421 + $is_visible = $this->getDurableColumnVisible(); 419 422 $durable_column = id(new ConpherenceDurableColumnView()) 420 423 ->setSelectedConpherence(null) 421 - ->setUser($user); 422 - Javelin::initBehavior( 423 - 'durable-column', 424 - array()); 424 + ->setUser($user) 425 + ->setVisible($is_visible); 425 426 } 426 427 427 428 Javelin::initBehavior('quicksand-blacklist', array( ··· 609 610 } 610 611 611 612 return array_mergev($blacklist); 613 + } 614 + 615 + private function getUserPreference($key, $default = null) { 616 + $request = $this->getRequest(); 617 + if (!$request) { 618 + return $default; 619 + } 620 + 621 + $user = $request->getUser(); 622 + if (!$user) { 623 + return $default; 624 + } 625 + 626 + return $user->loadPreferences()->getPreference($key, $default); 612 627 } 613 628 614 629 }
+28 -6
webroot/rsrc/js/application/conpherence/behavior-durable-column.js
··· 9 9 * conpherence-thread-manager 10 10 */ 11 11 12 - JX.behavior('durable-column', function() { 12 + JX.behavior('durable-column', function(config, statics) { 13 + // TODO: Currently, updating the column sends the entire column back. This 14 + // includes the `durable-column` behavior itself, which tries to re-initialize 15 + // the column. Detect this and bail. 16 + // 17 + // If ThreadManager gets separated into a UI part and a thread part (which 18 + // seems likely), responses may no longer ship back the entire column. This 19 + // might let us remove this check. 20 + if (statics.initialized) { 21 + return; 22 + } else { 23 + statics.initialized = true; 24 + } 13 25 14 26 var show = false; 15 27 var loadThreadID = null; ··· 27 39 return JX.DOM.find(column, 'div', 'conpherence-durable-column-main'); 28 40 } 29 41 30 - function _toggleColumn() { 31 - if (window.location.pathname.indexOf('/conpherence/') === 0) { 32 - return; 33 - } 42 + function _toggleColumn(explicit) { 34 43 show = !show; 35 44 JX.DOM.alterClass(frame, 'with-durable-column', show); 36 45 var column = JX.$('conpherence-durable-column'); ··· 42 51 } 43 52 JX.Stratcom.invoke('resize'); 44 53 JX.Quicksand.setFrame(show ? quick : null); 54 + 55 + // If this was an explicit toggle action from the user, save their 56 + // preference. 57 + if (explicit) { 58 + new JX.Request(config.settingsURI) 59 + .setData({value: (show ? 1 : 0)}) 60 + .send(); 61 + } 45 62 } 46 63 47 64 new JX.KeyboardShortcut('\\', 'Toggle Conpherence Column') 48 - .setHandler(_toggleColumn) 65 + .setHandler(JX.bind(null, _toggleColumn, true)) 49 66 .register(); 50 67 51 68 scrollbar = new JX.Scrollbar(_getColumnScrollNode()); ··· 55 72 /* Conpherence Thread Manager configuration - lots of display 56 73 * callbacks. 57 74 */ 75 + 58 76 var threadManager = new JX.ConpherenceThreadManager(); 59 77 threadManager.setMinimalDisplay(true); 60 78 threadManager.setLoadThreadURI('/conpherence/columnview/'); ··· 215 233 ['submit', 'didSyntheticSubmit'], 216 234 'conpherence-message-form', 217 235 _sendMessage); 236 + 237 + if (config.visible) { 238 + _toggleColumn(false); 239 + } 218 240 219 241 });