Remove some pending notifications when messages was read.
GitOrigin-RevId: 75446642bb9ac7d5473271da0ec9aed6a224cbdd
This commit is contained in:
parent
845946be45
commit
74ea0750a1
@ -8480,12 +8480,24 @@ void MessagesManager::set_dialog_last_read_inbox_message_id(Dialog *d, MessageId
|
|||||||
}
|
}
|
||||||
if (message_id != MessageId::min() && d->last_read_inbox_message_id.is_valid() && d->order != DEFAULT_ORDER &&
|
if (message_id != MessageId::min() && d->last_read_inbox_message_id.is_valid() && d->order != DEFAULT_ORDER &&
|
||||||
d->order != SPONSORED_DIALOG_ORDER) {
|
d->order != SPONSORED_DIALOG_ORDER) {
|
||||||
|
VLOG(notifications) << "Remove some notifications in " << d->dialog_id
|
||||||
|
<< " after updating last read inbox message to " << message_id
|
||||||
|
<< " and unread message count to " << server_unread_count << " + " << local_unread_count
|
||||||
|
<< " from " << source;
|
||||||
if (d->message_notification_group.group_id.is_valid()) {
|
if (d->message_notification_group.group_id.is_valid()) {
|
||||||
auto total_count = get_dialog_pending_notification_count(d, false);
|
auto total_count = get_dialog_pending_notification_count(d, false);
|
||||||
if (total_count == 0) {
|
if (total_count == 0) {
|
||||||
set_dialog_last_notification(d->dialog_id, d->message_notification_group, 0, NotificationId(),
|
set_dialog_last_notification(d->dialog_id, d->message_notification_group, 0, NotificationId(),
|
||||||
"set_dialog_last_read_inbox_message_id");
|
"set_dialog_last_read_inbox_message_id");
|
||||||
}
|
}
|
||||||
|
if (!d->pending_new_message_notifications.empty()) {
|
||||||
|
for (auto &it : d->pending_new_message_notifications) {
|
||||||
|
if (it.second.get() <= message_id.get()) {
|
||||||
|
it.first = DialogId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flush_pending_new_message_notifications(d->dialog_id, false, DialogId(UserId(1)));
|
||||||
|
}
|
||||||
total_count -= static_cast<int32>(d->pending_new_message_notifications.size());
|
total_count -= static_cast<int32>(d->pending_new_message_notifications.size());
|
||||||
if (total_count < 0) {
|
if (total_count < 0) {
|
||||||
LOG(ERROR) << "Total message notification count is " << total_count << " in " << d->dialog_id << " with "
|
LOG(ERROR) << "Total message notification count is " << total_count << " in " << d->dialog_id << " with "
|
||||||
|
Loading…
Reference in New Issue
Block a user