Fix total_count in SecretChat notification group after notification removal.
GitOrigin-RevId: 7bedbb220b3e5e59e3c6c293db9bed6819c01128
This commit is contained in:
parent
e69463f81d
commit
bcb7a9f6d2
@ -1857,9 +1857,10 @@ void NotificationManager::remove_notification(NotificationGroupId group_id, Noti
|
||||
}
|
||||
}
|
||||
|
||||
bool have_all_notifications = group_it->second.type == NotificationGroupType::Calls ||
|
||||
group_it->second.type == NotificationGroupType::SecretChat;
|
||||
bool is_total_count_changed = false;
|
||||
if ((group_it->second.type != NotificationGroupType::Calls && is_permanent) ||
|
||||
(group_it->second.type == NotificationGroupType::Calls && is_found)) {
|
||||
if ((!have_all_notifications && is_permanent) || (have_all_notifications && is_found)) {
|
||||
if (group_it->second.total_count == 0) {
|
||||
LOG(ERROR) << "Total notification count became negative in " << group_id << " after removing " << notification_id;
|
||||
} else {
|
||||
@ -2025,7 +2026,8 @@ void NotificationManager::remove_notification_group(NotificationGroupId group_id
|
||||
group_it->second.notifications.erase(group_it->second.notifications.begin(),
|
||||
group_it->second.notifications.begin() + notification_delete_end);
|
||||
}
|
||||
if (group_it->second.type == NotificationGroupType::Calls) {
|
||||
if (group_it->second.type == NotificationGroupType::Calls ||
|
||||
group_it->second.type == NotificationGroupType::SecretChat) {
|
||||
new_total_count = static_cast<int32>(group_it->second.notifications.size());
|
||||
}
|
||||
if (group_it->second.total_count == new_total_count) {
|
||||
|
Reference in New Issue
Block a user