From b8ca25941880d172b2e800f5c9345876e15b0818 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 31 Mar 2019 00:45:25 +0300 Subject: [PATCH] Force removal of group first wnen update is forced. GitOrigin-RevId: 3f4f9027d705c23bf3494acfa0941eba5cfc2676 --- td/telegram/NotificationManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index 6439b5cb..891dd217 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -1449,6 +1449,7 @@ void NotificationManager::flush_pending_notifications(NotificationGroupId group_ bool is_updated = final_group_key < last_group_key; bool force_update = false; + NotificationGroupId removed_group_id; if (!is_updated) { CHECK(!was_updated); VLOG(notifications) << "There is no need to send updateNotificationGroup in " << group_key @@ -1462,6 +1463,7 @@ void NotificationManager::flush_pending_notifications(NotificationGroupId group_ if (!was_updated) { if (last_group_key.last_notification_date != 0) { // need to remove last notification group to not exceed max_notification_group_count_ + removed_group_id = last_group_key.group_id; send_remove_group_update(last_group_key, groups_[last_group_key], vector()); } send_add_group_update(group_key, group); @@ -1502,7 +1504,10 @@ void NotificationManager::flush_pending_notifications(NotificationGroupId group_ add_group(std::move(final_group_key), std::move(group)); if (force_update) { - force_flush_pending_updates(group_key.group_id, "flush_pending_notifications"); + if (removed_group_id.is_valid()) { + force_flush_pending_updates(removed_group_id, "flush_pending_notifications 1"); + } + force_flush_pending_updates(group_key.group_id, "flush_pending_notifications 2"); } }