From c21301d153a9a988a00c9faed45fdb02d676fba9 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 16 Mar 2015 14:28:25 -0700 Subject: [PATCH] Conpherence - fix 0 messages in header race condition Summary: Fixes T7545. Turns out we had the right logic to handle this basically, and just needed to variablize the CSS class that gets added / removed as appropos. Note the new behavior is to keep the icon highlighted just with no number. This emulates how it would work if e.g. there was no unread message in the first place and you just clicked the message icon to invoke the message menu. Test Plan: had a durable conpherence open for user A with user B. used a separate browser to send message as user B. reloaded as user A - saw new message in conpherence durable column and the "1" unread icon. I then clicked the "1" and saw it disappear as expected Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7545 Differential Revision: https://secure.phabricator.com/D12091 --- resources/celerity/map.php | 26 +++++++++---------- .../page/menu/PhabricatorMainMenuView.php | 2 ++ .../aphlict/behavior-aphlict-dropdown.js | 4 +-- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 7958972924..f2adfb99a8 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -8,7 +8,7 @@ return array( 'names' => array( 'core.pkg.css' => 'a7f3dc55', - 'core.pkg.js' => '69f7e542', + 'core.pkg.js' => '75599122', 'darkconsole.pkg.js' => '8ab24e01', 'differential.pkg.css' => '1940be3f', 'differential.pkg.js' => '85fd84c6', @@ -347,7 +347,7 @@ return array( 'rsrc/image/texture/table_header_hover.png' => '038ec3b9', 'rsrc/image/texture/table_header_tall.png' => 'd56b434f', 'rsrc/js/application/aphlict/Aphlict.js' => '2be71d56', - 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '830b3278', + 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '00def500', 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'bdf2226d', 'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761', 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', @@ -543,7 +543,7 @@ return array( 'inline-comment-summary-css' => 'eb5f8e8c', 'javelin-aphlict' => '2be71d56', 'javelin-behavior' => '61cbc29a', - 'javelin-behavior-aphlict-dropdown' => '830b3278', + 'javelin-behavior-aphlict-dropdown' => '00def500', 'javelin-behavior-aphlict-listen' => 'bdf2226d', 'javelin-behavior-aphlict-status' => 'ea681761', 'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884', @@ -832,6 +832,16 @@ return array( 'unhandled-exception-css' => '37d4f9a2', ), 'requires' => array( + '00def500' => array( + 'javelin-behavior', + 'javelin-request', + 'javelin-stratcom', + 'javelin-vector', + 'javelin-dom', + 'javelin-uri', + 'javelin-behavior-device', + 'phabricator-title', + ), '0286a1db' => array( 'javelin-dom', 'javelin-util', @@ -1432,16 +1442,6 @@ return array( '82ce2142' => array( 'aphront-typeahead-control-css', ), - '830b3278' => array( - 'javelin-behavior', - 'javelin-request', - 'javelin-stratcom', - 'javelin-vector', - 'javelin-dom', - 'javelin-uri', - 'javelin-behavior-device', - 'phabricator-title', - ), '834a1173' => array( 'javelin-behavior', 'javelin-scrollbar', diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php index 422df58c38..4241b014c9 100644 --- a/src/view/page/menu/PhabricatorMainMenuView.php +++ b/src/view/page/menu/PhabricatorMainMenuView.php @@ -375,6 +375,7 @@ final class PhabricatorMainMenuView extends AphrontView { 'uri' => '/conpherence/panel/', 'countType' => 'messages', 'countNumber' => $message_count_number, + 'unreadClass' => 'message-unread', )); $message_notification_dropdown = javelin_tag( @@ -458,6 +459,7 @@ final class PhabricatorMainMenuView extends AphrontView { 'uri' => '/notification/panel/', 'countType' => 'notifications', 'countNumber' => $count_number, + 'unreadClass' => 'alert-unread', )); $notification_dropdown = javelin_tag( diff --git a/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js b/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js index 8b87826827..a847253766 100644 --- a/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js +++ b/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js @@ -49,9 +49,9 @@ JX.behavior('aphlict-dropdown', function(config, statics) { JX.DOM.setContent(count, display); if (response.number === 0) { - JX.DOM.alterClass(bubble, 'alert-unread', false); + JX.DOM.alterClass(bubble, config.unreadClass, false); } else { - JX.DOM.alterClass(bubble, 'alert-unread', true); + JX.DOM.alterClass(bubble, config.unreadClass, true); } dirty = false; JX.DOM.alterClass(