1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Conpherence - make show older messages work correctly in durable column

Summary:
Fixes T8009. This was basically moving the behavior from conpherence full behavior menu into the ConpherenceThreadManager so it could be re used in the durable column.

The durable column bit has no special styles - its just a link - but it seems to work well enough. I think it could be removed altogether if / when we add some automagical scrolling back into history stuff.

Test Plan: loaded up a conpherence in a durable column and used 'show older messages' successfully. loaded up a conpherence in regular view mid transaction and used show older and show newer successfully

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8009

Differential Revision: https://secure.phabricator.com/D12816
This commit is contained in:
Bob Trahan 2015-05-12 14:44:25 -07:00
parent 8e9ee86357
commit 048eb6cf61
4 changed files with 110 additions and 97 deletions

View file

@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => 'ed3d6355',
'core.pkg.js' => '3ed82e2f',
'core.pkg.js' => '616511ac',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => 'bb338e4b',
'differential.pkg.js' => '895b8d62',
@ -348,10 +348,10 @@ return array(
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/calendar/event-all-day.js' => 'ca5fa62a',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '9e507b59',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'de397217',
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
'rsrc/js/application/conpherence/behavior-durable-column.js' => 'bc5107aa',
'rsrc/js/application/conpherence/behavior-menu.js' => '804b0773',
'rsrc/js/application/conpherence/behavior-durable-column.js' => '61252a27',
'rsrc/js/application/conpherence/behavior-menu.js' => 'eb61cb03',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
'rsrc/js/application/conpherence/behavior-widget-pane.js' => '93568464',
@ -516,7 +516,7 @@ return array(
'conpherence-menu-css' => 'f389e048',
'conpherence-message-pane-css' => '0e75feef',
'conpherence-notification-css' => 'd208f806',
'conpherence-thread-manager' => '9e507b59',
'conpherence-thread-manager' => 'de397217',
'conpherence-transaction-css' => '42a457f6',
'conpherence-update-css' => '1099a660',
'conpherence-widget-pane-css' => '2af42ebe',
@ -557,7 +557,7 @@ return array(
'javelin-behavior-choose-control' => '6153c708',
'javelin-behavior-config-reorder-fields' => '14a827de',
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
'javelin-behavior-conpherence-menu' => '804b0773',
'javelin-behavior-conpherence-menu' => 'eb61cb03',
'javelin-behavior-conpherence-pontificate' => '21ba5861',
'javelin-behavior-conpherence-widget-pane' => '93568464',
'javelin-behavior-countdown-timer' => 'e4cc26b3',
@ -584,7 +584,7 @@ return array(
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
'javelin-behavior-diffusion-pull-lastmodified' => '2b228192',
'javelin-behavior-doorkeeper-tag' => 'e5822781',
'javelin-behavior-durable-column' => 'bc5107aa',
'javelin-behavior-durable-column' => '61252a27',
'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-event-all-day' => 'ca5fa62a',
'javelin-behavior-fancy-datepicker' => '5c0f680f',
@ -1256,6 +1256,16 @@ return array(
'javelin-stratcom',
'javelin-dom',
),
'61252a27' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-behavior-device',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
'conpherence-thread-manager',
),
'6153c708' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1395,20 +1405,6 @@ return array(
'javelin-behavior',
'javelin-history',
),
'804b0773' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'javelin-behavior-device',
'javelin-history',
'javelin-vector',
'javelin-scrollbar',
'phabricator-title',
'phabricator-shaped-request',
'conpherence-thread-manager',
),
82439934 => array(
'javelin-behavior',
'javelin-dom',
@ -1578,17 +1574,6 @@ return array(
'phuix-action-view',
'javelin-workflow',
),
'9e507b59' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-aphlict',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'9f36c42d' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1734,16 +1719,6 @@ return array(
'javelin-stratcom',
'javelin-dom',
),
'bc5107aa' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-behavior-device',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
'conpherence-thread-manager',
),
'bd4c8dca' => array(
'javelin-install',
'javelin-util',
@ -1857,6 +1832,17 @@ return array(
'javelin-typeahead-ondemand-source',
'javelin-dom',
),
'de397217' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-aphlict',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'df5e11d2' => array(
'javelin-install',
),
@ -1934,6 +1920,20 @@ return array(
'phabricator-phtize',
'javelin-dom',
),
'eb61cb03' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'javelin-behavior-device',
'javelin-history',
'javelin-vector',
'javelin-scrollbar',
'phabricator-title',
'phabricator-shaped-request',
'conpherence-thread-manager',
),
'efe49472' => array(
'javelin-install',
'javelin-util',

View file

@ -30,6 +30,7 @@ JX.install('ConpherenceThreadManager', {
_canEditLoadedThread: null,
_updating: null,
_minimalDisplay: false,
_messagesRootCallback: JX.bag,
_willLoadThreadCallback: JX.bag,
_didLoadThreadCallback: JX.bag,
_didUpdateThreadCallback: JX.bag,
@ -99,6 +100,11 @@ JX.install('ConpherenceThreadManager', {
return this;
},
setMessagesRootCallback: function(callback) {
this._messagesRootCallback = callback;
return this;
},
setWillLoadThreadCallback: function(callback) {
this._willLoadThreadCallback = callback;
return this;
@ -183,6 +189,52 @@ JX.install('ConpherenceThreadManager', {
this._updateThread();
}));
JX.Stratcom.listen(
'click',
'show-older-messages',
JX.bind(this, function(e) {
e.kill();
var data = e.getNodeData('show-older-messages');
var node = e.getNode('show-older-messages');
JX.DOM.setContent(node, 'Loading...');
JX.DOM.alterClass(
node,
'conpherence-show-more-messages-loading',
true);
new JX.Workflow(this._getMoreMessagesURI(), data)
.setHandler(JX.bind(this, function(r) {
JX.DOM.remove(node);
var messages = JX.$H(r.messages);
JX.DOM.prependContent(
this._messagesRootCallback(),
messages);
})).start();
}));
JX.Stratcom.listen(
'click',
'show-newer-messages',
JX.bind(this, function(e) {
e.kill();
var data = e.getNodeData('show-newer-messages');
var node = e.getNode('show-newer-messages');
JX.DOM.setContent(node, 'Loading...');
JX.DOM.alterClass(
node,
'conpherence-show-more-messages-loading',
true);
new JX.Workflow(this._getMoreMessagesURI(), data)
.setHandler(JX.bind(this, function(r) {
JX.DOM.remove(node);
var messages = JX.$H(r.messages);
JX.DOM.appendContent(
this._messagesRootCallback(),
JX.$H(messages));
})).start();
}));
},
_shouldUpdateDOM: function(r) {
@ -216,9 +268,7 @@ JX.install('ConpherenceThreadManager', {
action: 'load',
});
var uri = '/conpherence/update/' + this._loadedThreadID + '/';
var workflow = new JX.Workflow(uri)
var workflow = new JX.Workflow(this._getUpdateURI())
.setData(params)
.setHandler(JX.bind(this, function(r) {
if (this._shouldUpdateDOM(r)) {
@ -350,9 +400,8 @@ JX.install('ConpherenceThreadManager', {
var data = e.getNodeData('tag:form');
if (!data.preview) {
var uri = '/conpherence/update/' + this._loadedThreadID + '/';
data.preview = new JX.PhabricatorShapedRequest(
uri,
this._getUpdateURI(),
JX.bag,
JX.bind(this, function () {
var data = JX.DOM.convertFormToDictionary(form);
@ -362,6 +411,14 @@ JX.install('ConpherenceThreadManager', {
}));
}
data.preview.trigger();
},
_getUpdateURI: function() {
return '/conpherence/update/' + this._loadedThreadID + '/';
},
_getMoreMessagesURI: function() {
return '/conpherence/' + this._loadedThreadID + '/';
}
},

View file

@ -119,6 +119,9 @@ JX.behavior('durable-column', function(config, statics) {
var threadManager = new JX.ConpherenceThreadManager();
threadManager.setMinimalDisplay(true);
threadManager.setMessagesRootCallback(function() {
return _getColumnMessagesNode();
});
threadManager.setLoadThreadURI('/conpherence/columnview/');
threadManager.setWillLoadThreadCallback(function() {
_markLoading(true);

View file

@ -28,6 +28,9 @@ JX.behavior('conpherence-menu', function(config) {
// TODO - move more logic into the ThreadManager
var threadManager = new JX.ConpherenceThreadManager();
threadManager.setMessagesRootCallback(function() {
return scrollbar.getContentNode();
});
threadManager.setWillLoadThreadCallback(function() {
markThreadLoading(true);
});
@ -415,56 +418,6 @@ JX.behavior('conpherence-menu', function(config) {
.start();
});
var _oldLoadingTransactionID = null;
JX.Stratcom.listen('click', 'show-older-messages', function(e) {
e.kill();
var data = e.getNodeData('show-older-messages');
if (data.oldest_transaction_id == _oldLoadingTransactionID) {
return;
}
_oldLoadingTransactionID = data.oldest_transaction_id;
var node = e.getNode('show-older-messages');
JX.DOM.setContent(node, 'Loading...');
JX.DOM.alterClass(node, 'conpherence-show-more-messages-loading', true);
var conf_id = _thread.selected;
var messages_root = scrollbar.getContentNode();
new JX.Workflow(config.baseURI + conf_id + '/', data)
.setHandler(function(r) {
JX.DOM.remove(node);
var messages = JX.$H(r.messages);
JX.DOM.prependContent(
messages_root,
JX.$H(messages));
}).start();
});
var _newLoadingTransactionID = null;
JX.Stratcom.listen('click', 'show-newer-messages', function(e) {
e.kill();
var data = e.getNodeData('show-newer-messages');
if (data.newest_transaction_id == _newLoadingTransactionID) {
return;
}
_newLoadingTransactionID = data.newest_transaction_id;
var node = e.getNode('show-newer-messages');
JX.DOM.setContent(node, 'Loading...');
JX.DOM.alterClass(node, 'conpherence-show-more-messages-loading', true);
var conf_id = _thread.selected;
var messages_root = scrollbar.getContentNode();
new JX.Workflow(config.baseURI + conf_id + '/', data)
.setHandler(function(r) {
JX.DOM.remove(node);
var messages = JX.$H(r.messages);
JX.DOM.appendContent(
messages_root,
JX.$H(messages));
}).start();
});
/**
* On devices, we just show a thread list, so we don't want to automatically
* select or load any threads. On desktop, we automatically select the first