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

@@ -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);