From bc101e7c734b95d8eeb67ea7593b926bdb8ac06a Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Thu, 14 May 2015 11:14:07 -0700 Subject: [PATCH] Conpherence - fix disappearing older messages bug Summary: Fixes T8194. If you loaded a conpherence directly via a URI like /Z1 or /conpherence/1/ we didn't correctly cache the loaded transactions such that sending a message would only show that message and subsequent messages. Fix is to build the cache properly in this case. Note this codepath is different because the server sends back more of the thread data in the initial request. Test Plan: loaded a conpherence directly, sent messages, paged back, everything kept showing! Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8194 Differential Revision: https://secure.phabricator.com/D12844 --- resources/celerity/map.php | 60 +++++++++---------- .../conpherence/ConpherenceThreadManager.js | 18 +++--- .../application/conpherence/behavior-menu.js | 1 + 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index c4bb78b856..6b31b64958 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -8,7 +8,7 @@ return array( 'names' => array( 'core.pkg.css' => '7ac320f1', - 'core.pkg.js' => 'ac41c400', + 'core.pkg.js' => 'a2f2598e', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => 'bb338e4b', 'differential.pkg.js' => '895b8d62', @@ -332,10 +332,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' => 'b7342ddb', + 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '10246726', 'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a', 'rsrc/js/application/conpherence/behavior-durable-column.js' => '16c695bf', - 'rsrc/js/application/conpherence/behavior-menu.js' => '4351c4a0', + 'rsrc/js/application/conpherence/behavior-menu.js' => 'c0348cac', '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', @@ -500,7 +500,7 @@ return array( 'conpherence-menu-css' => 'f389e048', 'conpherence-message-pane-css' => '5bb4b76d', 'conpherence-notification-css' => '919974b6', - 'conpherence-thread-manager' => 'b7342ddb', + 'conpherence-thread-manager' => '10246726', 'conpherence-transaction-css' => '42a457f6', 'conpherence-update-css' => '1099a660', 'conpherence-widget-pane-css' => '2af42ebe', @@ -541,7 +541,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' => '4351c4a0', + 'javelin-behavior-conpherence-menu' => 'c0348cac', 'javelin-behavior-conpherence-pontificate' => '21ba5861', 'javelin-behavior-conpherence-widget-pane' => '93568464', 'javelin-behavior-countdown-timer' => 'e4cc26b3', @@ -876,6 +876,17 @@ return array( 'javelin-install', 'javelin-util', ), + 10246726 => array( + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-install', + 'javelin-aphlict', + 'javelin-workflow', + 'javelin-router', + 'javelin-behavior-device', + 'javelin-vector', + ), '13c739ea' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1067,20 +1078,6 @@ return array( 'javelin-dom', 'javelin-request', ), - '4351c4a0' => 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', - ), '44168bad' => array( 'javelin-behavior', 'javelin-dom', @@ -1703,17 +1700,6 @@ return array( 'javelin-dom', 'javelin-util', ), - 'b7342ddb' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-aphlict', - 'javelin-workflow', - 'javelin-router', - 'javelin-behavior-device', - 'javelin-vector', - ), 'ba4fa35c' => array( 'javelin-behavior', 'javelin-dom', @@ -1747,6 +1733,20 @@ return array( 'javelin-util', 'phabricator-shaped-request', ), + 'c0348cac' => 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', + ), 'c1700f6f' => array( 'javelin-install', 'javelin-util', diff --git a/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js b/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js index c1c47c5c78..71c1af139b 100644 --- a/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js +++ b/webroot/rsrc/js/application/conpherence/ConpherenceThreadManager.js @@ -330,6 +330,16 @@ JX.install('ConpherenceThreadManager', { JX.DOM.setContent(this._messagesRootCallback(), transactions); }, + cacheCurrentTransactions: function() { + var root = this._messagesRootCallback(); + var transactions = JX.DOM.scry( + root , + 'div', + 'conpherence-transaction-view'); + this._updateTransactionIDMap(transactions); + this._updateTransactionCache(transactions); + }, + _updateThread: function() { var params = this._getParams({ action: 'load', @@ -422,13 +432,7 @@ JX.install('ConpherenceThreadManager', { r.aphlictDropdownData); this._didLoadThreadCallback(r); - var messages_root = this._messagesRootCallback(); - var messages = JX.DOM.scry( - messages_root, - 'div', - 'conpherence-transaction-view'); - this._updateTransactionIDMap(messages); - this._updateTransactionCache(messages); + this.cacheCurrentTransactions(); if (force_reload) { JX.Stratcom.invoke('hashchange'); diff --git a/webroot/rsrc/js/application/conpherence/behavior-menu.js b/webroot/rsrc/js/application/conpherence/behavior-menu.js index 2233b3ff28..5dcbffaed8 100644 --- a/webroot/rsrc/js/application/conpherence/behavior-menu.js +++ b/webroot/rsrc/js/application/conpherence/behavior-menu.js @@ -191,6 +191,7 @@ JX.behavior('conpherence-menu', function(config) { threadManager.setLoadedThreadPHID(config.selectedThreadPHID); threadManager.setLatestTransactionID(config.latestTransactionID); threadManager.setCanEditLoadedThread(config.canEditSelectedThread); + threadManager.cacheCurrentTransactions(); _scrollMessageWindow(); _focusTextarea(); } else { -- 2.51.2