Page MenuHomePhabricator

D12038.id28976.diff
No OneTemporary

D12038.id28976.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -44,7 +44,7 @@
'rsrc/css/application/config/config-welcome.css' => '6abd79be',
'rsrc/css/application/config/setup-issue.css' => '22270af2',
'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2',
- 'rsrc/css/application/conpherence/durable-column.css' => '9207426d',
+ 'rsrc/css/application/conpherence/durable-column.css' => '7abcc3f2',
'rsrc/css/application/conpherence/menu.css' => 'c6ac5299',
'rsrc/css/application/conpherence/message-pane.css' => '5930260a',
'rsrc/css/application/conpherence/notification.css' => '04a6e10a',
@@ -353,7 +353,7 @@
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'efef202b',
- 'rsrc/js/application/conpherence/behavior-durable-column.js' => '1eef9f26',
+ 'rsrc/js/application/conpherence/behavior-durable-column.js' => '1fdfac8c',
'rsrc/js/application/conpherence/behavior-menu.js' => 'e476c952',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
@@ -515,7 +515,7 @@
'changeset-view-manager' => '88be0133',
'config-options-css' => '7fedf08b',
'config-welcome-css' => '6abd79be',
- 'conpherence-durable-column-view' => '9207426d',
+ 'conpherence-durable-column-view' => '7abcc3f2',
'conpherence-menu-css' => 'c6ac5299',
'conpherence-message-pane-css' => '5930260a',
'conpherence-notification-css' => '04a6e10a',
@@ -586,7 +586,7 @@
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
'javelin-behavior-diffusion-pull-lastmodified' => '2b228192',
'javelin-behavior-doorkeeper-tag' => 'e5822781',
- 'javelin-behavior-durable-column' => '1eef9f26',
+ 'javelin-behavior-durable-column' => '1fdfac8c',
'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-fancy-datepicker' => 'c51ae228',
'javelin-behavior-global-drag-and-drop' => '07f199d8',
@@ -956,7 +956,7 @@
'javelin-dom',
'javelin-reactor-dom',
),
- '1eef9f26' => array(
+ '1fdfac8c' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
diff --git a/src/applications/conpherence/view/ConpherenceDurableColumnView.php b/src/applications/conpherence/view/ConpherenceDurableColumnView.php
--- a/src/applications/conpherence/view/ConpherenceDurableColumnView.php
+++ b/src/applications/conpherence/view/ConpherenceDurableColumnView.php
@@ -5,6 +5,7 @@
private $conpherences;
private $selectedConpherence;
private $transactions;
+ private $visible;
public function setConpherences(array $conpherences) {
assert_instances_of($conpherences, 'ConpherenceThread');
@@ -36,16 +37,40 @@
return $this->transactions;
}
+ public function setVisible($visible) {
+ $this->visible = $visible;
+ return $this;
+ }
+
+ public function getVisible() {
+ return $this->visible;
+ }
+
protected function getTagAttributes() {
+ if ($this->getVisible()) {
+ $style = null;
+ } else {
+ $style = 'display: none;';
+ }
+
return array(
'id' => 'conpherence-durable-column',
'class' => 'conpherence-durable-column',
- 'style' => 'display: none;',
+ 'style' => $style,
'sigil' => 'conpherence-durable-column',
);
}
protected function getTagContent() {
+ $column_key = PhabricatorUserPreferences::PREFERENCE_CONPHERENCE_COLUMN;
+
+ Javelin::initBehavior(
+ 'durable-column',
+ array(
+ 'visible' => $this->getVisible(),
+ 'settingsURI' => '/settings/adjust/?key='.$column_key,
+ ));
+
$classes = array();
$classes[] = 'conpherence-durable-column-header';
$classes[] = 'sprite-main-header';
diff --git a/src/applications/settings/storage/PhabricatorUserPreferences.php b/src/applications/settings/storage/PhabricatorUserPreferences.php
--- a/src/applications/settings/storage/PhabricatorUserPreferences.php
+++ b/src/applications/settings/storage/PhabricatorUserPreferences.php
@@ -31,7 +31,8 @@
const PREFERENCE_DIFF_UNIFIED = 'diff-unified';
const PREFERENCE_DIFF_FILETREE = 'diff-filetree';
- const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
+ const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
+ const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column';
// These are in an unusual order for historic reasons.
const MAILTAG_PREFERENCE_NOTIFY = 0;
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -108,16 +108,18 @@
return true;
}
- public function getTitle() {
- $use_glyph = true;
+ public function getDurableColumnVisible() {
+ $column_key = PhabricatorUserPreferences::PREFERENCE_CONPHERENCE_COLUMN;
+ return (bool)$this->getUserPreference($column_key, 0);
+ }
- $request = $this->getRequest();
- if ($request) {
- $user = $request->getUser();
- if ($user && $user->loadPreferences()->getPreference(
- PhabricatorUserPreferences::PREFERENCE_TITLES) !== 'glyph') {
- $use_glyph = false;
- }
+
+ public function getTitle() {
+ $glyph_key = PhabricatorUserPreferences::PREFERENCE_TITLES;
+ if ($this->getUserPreference($glyph_key) == 'text') {
+ $use_glyph = false;
+ } else {
+ $use_glyph = true;
}
$title = parent::getTitle();
@@ -416,12 +418,11 @@
$durable_column = null;
if ($this->getShowDurableColumn()) {
+ $is_visible = $this->getDurableColumnVisible();
$durable_column = id(new ConpherenceDurableColumnView())
->setSelectedConpherence(null)
- ->setUser($user);
- Javelin::initBehavior(
- 'durable-column',
- array());
+ ->setUser($user)
+ ->setVisible($is_visible);
}
Javelin::initBehavior('quicksand-blacklist', array(
@@ -611,4 +612,18 @@
return array_mergev($blacklist);
}
+ private function getUserPreference($key, $default = null) {
+ $request = $this->getRequest();
+ if (!$request) {
+ return $default;
+ }
+
+ $user = $request->getUser();
+ if (!$user) {
+ return $default;
+ }
+
+ return $user->loadPreferences()->getPreference($key, $default);
+ }
+
}
diff --git a/webroot/rsrc/js/application/conpherence/behavior-durable-column.js b/webroot/rsrc/js/application/conpherence/behavior-durable-column.js
--- a/webroot/rsrc/js/application/conpherence/behavior-durable-column.js
+++ b/webroot/rsrc/js/application/conpherence/behavior-durable-column.js
@@ -9,7 +9,7 @@
* conpherence-thread-manager
*/
-JX.behavior('durable-column', function() {
+JX.behavior('durable-column', function(config) {
var show = false;
var loadThreadID = null;
@@ -27,10 +27,7 @@
return JX.DOM.find(column, 'div', 'conpherence-durable-column-main');
}
- function _toggleColumn() {
- if (window.location.pathname.indexOf('/conpherence/') === 0) {
- return;
- }
+ function _toggleColumn(explicit) {
show = !show;
JX.DOM.alterClass(frame, 'with-durable-column', show);
var column = JX.$('conpherence-durable-column');
@@ -42,10 +39,18 @@
}
JX.Stratcom.invoke('resize');
JX.Quicksand.setFrame(show ? quick : null);
+
+ // If this was an explicit toggle action from the user, save their
+ // preference.
+ if (explicit) {
+ new JX.Request(config.settingsURI)
+ .setData({value: (show ? 1 : 0)})
+ .send();
+ }
}
new JX.KeyboardShortcut('\\', 'Toggle Conpherence Column')
- .setHandler(_toggleColumn)
+ .setHandler(JX.bind(null, _toggleColumn, true))
.register();
scrollbar = new JX.Scrollbar(_getColumnScrollNode());
@@ -216,4 +221,8 @@
'conpherence-message-form',
_sendMessage);
+ if (config.visible) {
+ _toggleColumn(false);
+ }
+
});

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 14, 6:37 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7400033
Default Alt Text
D12038.id28976.diff (8 KB)

Event Timeline