mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
top_left_corner: Fix new mention animation when loading app.
Apparently some past refactor caused the animation for new mentions to be triggered when initialization the app. (This seems pretty clearly unintentional: A user loading the app doesn't need their attention specifically drawn to the @-mentions view in the same way that a user who is using the app and receives a mention right now does.)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
//
|
||||
|
||||
@@ -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_row
|
||||
top_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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user