From 8fe78c9029e580d8338a95ea406e882625ffdd87 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 17 Mar 2015 13:40:36 -0700 Subject: [PATCH] Conpherence - update the "unread" count in notifications panel aggressively Summary: Fixes T7561. Basically everytime we load some transactions in the thread manager, kick off an async thread to update the notification panel. Should I consolidate this little bit of code into something like this._handleTransactionResponse(r)... ? I just want to keep the JS clear for other engineers and I wasn't sure if that was hiding a bit too much detail. Test Plan: user a opened durable column. user b sent user a a few messages. reloaded user a page and noted the "N" count became N-1 as the message loaded. Switched messages and saw N-2, N-3, etc as I loaded up the messages. Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7561 Differential Revision: https://secure.phabricator.com/D12099 --- resources/celerity/map.php | 24 +++++++++---------- .../conpherence/ConpherenceThreadManager.js | 9 ++++++- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 0e89d55beb..81084bf957 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -352,7 +352,7 @@ return array( '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' => 'bbc850a4', + 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '6a9169bb', 'rsrc/js/application/conpherence/behavior-durable-column.js' => 'e975bd12', 'rsrc/js/application/conpherence/behavior-menu.js' => 'c4151295', 'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861', @@ -517,7 +517,7 @@ return array( 'conpherence-menu-css' => 'c6ac5299', 'conpherence-message-pane-css' => '2526107d', 'conpherence-notification-css' => '04a6e10a', - 'conpherence-thread-manager' => 'bbc850a4', + 'conpherence-thread-manager' => '6a9169bb', 'conpherence-update-css' => '1099a660', 'conpherence-widget-pane-css' => '3d575438', 'differential-changeset-view-css' => '6a8b172a', @@ -1270,6 +1270,16 @@ return array( '69adf288' => array( 'javelin-install', ), + '6a9169bb' => array( + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-install', + 'javelin-workflow', + 'javelin-router', + 'javelin-behavior-device', + 'javelin-vector', + ), '6c2b09a2' => array( 'javelin-install', 'javelin-util', @@ -1684,16 +1694,6 @@ return array( 'javelin-stratcom', 'javelin-dom', ), - 'bbc850a4' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-workflow', - 'javelin-router', - 'javelin-behavior-device', - 'javelin-vector', - ), 'bbdf75ca' => array( 'javelin-behavior', 'javelin-dom', diff --git a/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js b/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js index c83ce96cee..ba7696df91 100644 --- a/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js +++ b/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js @@ -202,8 +202,10 @@ JX.install('ConpherenceThreadManager', { return; } } - this._latestTransactionID = r.latest_transaction_id; this._updating.knownID = r.latest_transaction_id; + this._latestTransactionID = r.latest_transaction_id; + JX.Stratcom.invoke('notification-panel-update', null, {}); + this._didUpdateThreadCallback(r); })); @@ -234,6 +236,8 @@ JX.install('ConpherenceThreadManager', { .setHandler(JX.bind(this, function(r) { if (this._shouldUpdateDOM(r)) { this._latestTransactionID = r.latest_transaction_id; + JX.Stratcom.invoke('notification-panel-update', null, {}); + this._didUpdateWorkflowCallback(r); } })); @@ -259,6 +263,7 @@ JX.install('ConpherenceThreadManager', { this._loadedThreadID = r.threadID; this._loadedThreadPHID = r.threadPHID; this._latestTransactionID = r.latestTransactionID; + JX.Stratcom.invoke('notification-panel-update', null, {}); this._didLoadThreadCallback(r); }); @@ -279,6 +284,8 @@ JX.install('ConpherenceThreadManager', { .setHandler(JX.bind(this, function(r) { if (this._shouldUpdateDOM(r)) { this._latestTransactionID = r.latest_transaction_id; + JX.Stratcom.invoke('notification-panel-update', null, {}); + this._didSendMessageCallback(r); } }));