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

Conpherence - make sure real time updates still work if you switch threads

Summary: Fixes T8118. Turns out this also was broken in the main view if e.g. you went to just /conpherence/. The fix is to make sure the threadmanager js class explicitly manages subscriptions as the loaded thread changes.

Test Plan:
 - from /conpherence/ was able to receive messages in real time.
 - from /conpherence/ changed threads and still received messages in real time
 - from durable column switched threads and received messages in real time

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8118

Differential Revision: https://secure.phabricator.com/D12758
This commit is contained in:
Bob Trahan 2015-05-07 12:47:49 -07:00
parent 791e897c0d
commit 524aee03dc
3 changed files with 44 additions and 22 deletions

View file

@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => 'ca3f6a60',
'core.pkg.js' => 'f6b48b53',
'core.pkg.js' => '5a18f0ab',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => 'bb338e4b',
'differential.pkg.js' => '895b8d62',
@ -340,13 +340,13 @@ return array(
'rsrc/image/texture/table_header.png' => '5c433037',
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
'rsrc/js/application/aphlict/Aphlict.js' => '30a6303c',
'rsrc/js/application/aphlict/Aphlict.js' => '5359e785',
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '0323afdd',
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'f8dace3b',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '7a608e21',
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
'rsrc/js/application/conpherence/behavior-durable-column.js' => '657c2b50',
'rsrc/js/application/conpherence/behavior-menu.js' => '804b0773',
@ -513,7 +513,7 @@ return array(
'conpherence-menu-css' => 'f389e048',
'conpherence-message-pane-css' => '3150e2a2',
'conpherence-notification-css' => 'd208f806',
'conpherence-thread-manager' => 'f8dace3b',
'conpherence-thread-manager' => '7a608e21',
'conpherence-transaction-css' => '25138b7f',
'conpherence-update-css' => '1099a660',
'conpherence-widget-pane-css' => '2af42ebe',
@ -539,7 +539,7 @@ return array(
'herald-test-css' => '778b008e',
'homepage-panel-css' => 'e34bf140',
'inline-comment-summary-css' => 'eb5f8e8c',
'javelin-aphlict' => '30a6303c',
'javelin-aphlict' => '5359e785',
'javelin-behavior' => '61cbc29a',
'javelin-behavior-aphlict-dropdown' => '0323afdd',
'javelin-behavior-aphlict-listen' => 'b1a59974',
@ -1022,13 +1022,6 @@ return array(
'javelin-install',
'javelin-event',
),
'30a6303c' => array(
'javelin-install',
'javelin-util',
'javelin-websocket',
'javelin-leader',
'javelin-json',
),
'316b8fa1' => array(
'javelin-install',
'javelin-typeahead-source',
@ -1155,6 +1148,13 @@ return array(
'javelin-dom',
'javelin-reactor-dom',
),
'5359e785' => array(
'javelin-install',
'javelin-util',
'javelin-websocket',
'javelin-leader',
'javelin-json',
),
'54b612ba' => array(
'javelin-color',
'javelin-install',
@ -1380,6 +1380,17 @@ return array(
'javelin-behavior',
'javelin-quicksand',
),
'7a608e21' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-aphlict',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'7a68dda3' => array(
'owners-path-editor',
'javelin-behavior',
@ -1987,16 +1998,6 @@ return array(
'javelin-util',
'phabricator-busy',
),
'f8dace3b' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'f9539603' => array(
'javelin-behavior',
'javelin-dom',

View file

@ -49,6 +49,10 @@ JX.install('Aphlict', {
JX.Leader.call(JX.bind(this, this._begin));
},
getSubscriptions: function() {
return this._subscriptions;
},
setSubscriptions: function(subscriptions) {
this._subscriptions = subscriptions;
JX.Leader.broadcast(

View file

@ -4,6 +4,7 @@
* javelin-util
* javelin-stratcom
* javelin-install
* javelin-aphlict
* javelin-workflow
* javelin-router
* javelin-behavior-device
@ -277,10 +278,26 @@ JX.install('ConpherenceThreadManager', {
params = this._getParams(params);
var handler = JX.bind(this, function(r) {
var client = JX.Aphlict.getInstance();
if (client) {
var old_subs = client.getSubscriptions();
var new_subs = [];
for (var ii = 0; ii < old_subs.length; ii++) {
if (old_subs[ii] == this._loadedThreadPHID) {
continue;
} else {
new_subs.push(old_subs[ii]);
}
}
new_subs.push(r.threadPHID);
client.clearSubscriptions(client.getSubscriptions());
client.setSubscriptions(new_subs);
}
this._loadedThreadID = r.threadID;
this._loadedThreadPHID = r.threadPHID;
this._latestTransactionID = r.latestTransactionID;
this._canEditLoadedThread = r.canEdit;
JX.Stratcom.invoke('notification-panel-update', null, {});
this._didLoadThreadCallback(r);