From 8a95f1d21e32877bac2e33d20c04c09e6821ddef Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 31 May 2020 02:13:00 +0300 Subject: [PATCH] Do not update unreceived notification update count if received duplicate group_id. GitOrigin-RevId: 7856aef2ce0fc42ab76ffbb5e4fe1f613f933ad5 --- td/telegram/MessagesManager.cpp | 1 + td/telegram/NotificationManager.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 3a810133f..27c28620f 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -29192,6 +29192,7 @@ void MessagesManager::do_get_channel_difference(DialogId dialog_id, int32 pts, b return; } + // can be called multiple times before after_get_channel_difference const Dialog *d = get_dialog(dialog_id); if (d != nullptr) { if (d->message_notification_group.group_id.is_valid()) { diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index 56c22ca27..4e784f107 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -3903,8 +3903,9 @@ void NotificationManager::before_get_chat_difference(NotificationGroupId group_i VLOG(notifications) << "Before get chat difference in " << group_id; CHECK(group_id.is_valid()); - running_get_chat_difference_.insert(group_id.get()); - on_unreceived_notification_update_count_changed(1, group_id.get(), "before_get_chat_difference"); + if (running_get_chat_difference_.insert(group_id.get()).second) { + on_unreceived_notification_update_count_changed(1, group_id.get(), "before_get_chat_difference"); + } } void NotificationManager::after_get_chat_difference(NotificationGroupId group_id) {