Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
top_left_corner: Fix new mention animation when loading app.
Tim Abbott976b0662eaa6
diff --git a/web/src/top_left_corner.js b/web/src/top_left_corner.jsindex b43e17dfe39..462d1ed831b 100644--- a/web/src/top_left_corner.js+++ b/web/src/top_left_corner.js@@ -22,7 +22,7 @@ export function update_scheduled_messages_row() {ui_util.update_unread_count_in_dom($scheduled_li, count);}-export function update_dom_with_unread_counts(counts) {+export function update_dom_with_unread_counts(counts, skip_animations) {// Note that "Private messages" counts are handled in pm_list.js.// mentioned/home have simple integer counts@@ -32,7 +32,9 @@ export function update_dom_with_unread_counts(counts) {ui_util.update_unread_count_in_dom($mentioned_li, counts.mentioned_message_count);ui_util.update_unread_count_in_dom($home_li, counts.home_unread_messages);- animate_mention_changes($mentioned_li, counts.mentioned_message_count);+ if (!skip_animations) {+ animate_mention_changes($mentioned_li, counts.mentioned_message_count);+ }}function remove($elem) {diff --git a/web/src/unread_ui.js b/web/src/unread_ui.jsindex 04a71a1c9f9..93bc3d69fcd 100644--- a/web/src/unread_ui.js+++ b/web/src/unread_ui.js@@ -75,7 +75,7 @@ export function set_count_toggle_button($elem, count) {return $elem.text("1k+");}-export function update_unread_counts() {+export function update_unread_counts(skip_animations = false) {// Pure computation:const res = unread.get_counts();@@ -83,7 +83,7 @@ export function update_unread_counts() {// This updates some DOM elements directly, so try to// avoid excessive calls to this.activity.update_dom_with_unread_counts(res);- top_left_corner.update_dom_with_unread_counts(res);+ top_left_corner.update_dom_with_unread_counts(res, skip_animations);stream_list.update_dom_with_unread_counts(res);pm_list.update_dom_with_unread_counts(res);topic_list.update();@@ -125,7 +125,8 @@ export function should_display_bankruptcy_banner() {}export function initialize() {- update_unread_counts();+ const skip_animations = true;+ update_unread_counts(skip_animations);$("body").on("click", "#mark_view_read", () => {// Mark all messages in the current view as read.//diff --git a/web/tests/top_left_corner.test.js b/web/tests/top_left_corner.test.jsindex fd4322d1fc0..306a08a0b15 100644--- a/web/tests/top_left_corner.test.js+++ b/web/tests/top_left_corner.test.js@@ -74,7 +74,7 @@ run_test("update_count_in_dom", () => {make_elem($(".top_left_scheduled_messages"), "<scheduled-count>");- top_left_corner.update_dom_with_unread_counts(counts);+ top_left_corner.update_dom_with_unread_counts(counts, false);top_left_corner.update_starred_count(444);// Calls top_left_corner.update_scheduled_messages_rowtop_left_corner.initialize();@@ -87,7 +87,7 @@ run_test("update_count_in_dom", () => {counts.mentioned_message_count = 0;scheduled_messages.get_count = () => 0;- top_left_corner.update_dom_with_unread_counts(counts);+ top_left_corner.update_dom_with_unread_counts(counts, false);top_left_corner.update_starred_count(0);top_left_corner.update_scheduled_messages_row();