Make NotificationGroupInfo.::max_removed_notification_id_ private.
This commit is contained in:
parent
4e031ed7fd
commit
5450d2e53d
@ -16173,7 +16173,7 @@ void MessagesManager::fix_dialog_last_notification_id(Dialog *d, bool from_menti
|
|||||||
const Message *m = get_message(d, (*it)->get_message_id());
|
const Message *m = get_message(d, (*it)->get_message_id());
|
||||||
if (is_from_mention_notification_group(m) == from_mentions && m->notification_id.is_valid() &&
|
if (is_from_mention_notification_group(m) == from_mentions && m->notification_id.is_valid() &&
|
||||||
is_message_notification_active(d, m) && m->message_id != message_id) {
|
is_message_notification_active(d, m) && m->message_id != message_id) {
|
||||||
set_dialog_last_notification_checked(d->dialog_id, group_info, m->date, m->notification_id,
|
set_dialog_last_notification(d->dialog_id, group_info, m->date, m->notification_id,
|
||||||
"fix_dialog_last_notification_id");
|
"fix_dialog_last_notification_id");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -16222,7 +16222,7 @@ void MessagesManager::do_fix_dialog_last_notification_id(DialogId dialog_id, boo
|
|||||||
last_notification_id = notifications[0].notification_id;
|
last_notification_id = notifications[0].notification_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_dialog_last_notification_checked(dialog_id, group_info, last_notification_date, last_notification_id,
|
set_dialog_last_notification(dialog_id, group_info, last_notification_date, last_notification_id,
|
||||||
"do_fix_dialog_last_notification_id");
|
"do_fix_dialog_last_notification_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30095,12 +30095,10 @@ void MessagesManager::remove_all_dialog_notifications(Dialog *d, bool from_menti
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NotificationGroupInfo &group_info = get_notification_group_info(d, from_mentions);
|
NotificationGroupInfo &group_info = get_notification_group_info(d, from_mentions);
|
||||||
if (group_info.group_id_.is_valid() && group_info.last_notification_id_.is_valid() &&
|
if (group_info.group_id_.is_valid() && group_info.last_notification_id_.is_valid()) {
|
||||||
group_info.max_removed_notification_id_ != group_info.last_notification_id_) {
|
group_info.set_max_removed_notification_id(group_info.last_notification_id_,
|
||||||
if (group_info.set_max_removed_notification_id(group_info.last_notification_id_,
|
d->notification_info->max_notification_message_id_, source);
|
||||||
d->notification_info->max_notification_message_id_, source)) {
|
|
||||||
on_dialog_updated(d->dialog_id, source);
|
on_dialog_updated(d->dialog_id, source);
|
||||||
}
|
|
||||||
|
|
||||||
if (!d->notification_info->pending_new_message_notifications_.empty()) {
|
if (!d->notification_info->pending_new_message_notifications_.empty()) {
|
||||||
for (auto &it : d->notification_info->pending_new_message_notifications_) {
|
for (auto &it : d->notification_info->pending_new_message_notifications_) {
|
||||||
@ -36707,16 +36705,6 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
|||||||
on_dialog_updated(dialog_id, "fix pinned message notification 2");
|
on_dialog_updated(dialog_id, "fix pinned message notification 2");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (d->notification_info != nullptr && d->notification_info->new_secret_chat_notification_id_.is_valid()) {
|
|
||||||
auto &group_info = d->notification_info->message_notification_group_;
|
|
||||||
if (group_info.is_removed_notification_id(d->notification_info->new_secret_chat_notification_id_) ||
|
|
||||||
(group_info.last_notification_date_ == 0 && group_info.max_removed_notification_id_.get() == 0)) {
|
|
||||||
VLOG(notifications) << "Fix removing new secret chat " << d->notification_info->new_secret_chat_notification_id_
|
|
||||||
<< " in " << dialog_id;
|
|
||||||
d->notification_info->new_secret_chat_notification_id_ = NotificationId();
|
|
||||||
on_dialog_updated(dialog_id, "fix new secret chat notification identifier");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto it = pending_add_dialog_last_database_message_dependent_dialogs_.find(dialog_id);
|
auto it = pending_add_dialog_last_database_message_dependent_dialogs_.find(dialog_id);
|
||||||
|
@ -14,6 +14,10 @@ namespace td {
|
|||||||
|
|
||||||
bool NotificationGroupInfo::set_last_notification(int32 last_notification_date, NotificationId last_notification_id,
|
bool NotificationGroupInfo::set_last_notification(int32 last_notification_date, NotificationId last_notification_id,
|
||||||
const char *source) {
|
const char *source) {
|
||||||
|
if (is_removed_notification_id(last_notification_id)) {
|
||||||
|
last_notification_id = NotificationId();
|
||||||
|
last_notification_date = 0;
|
||||||
|
}
|
||||||
if (last_notification_date_ != last_notification_date || last_notification_id_ != last_notification_id) {
|
if (last_notification_date_ != last_notification_date || last_notification_id_ != last_notification_id) {
|
||||||
VLOG(notifications) << "Set " << group_id_ << " last notification to " << last_notification_id << " sent at "
|
VLOG(notifications) << "Set " << group_id_ << " last notification to " << last_notification_id << " sent at "
|
||||||
<< last_notification_date << " from " << source;
|
<< last_notification_date << " from " << source;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
class NotificationGroupInfo {
|
class NotificationGroupInfo {
|
||||||
|
NotificationId max_removed_notification_id_; // notification identifier, up to which all notifications are removed
|
||||||
MessageId max_removed_message_id_; // message identifier, up to which all notifications are removed
|
MessageId max_removed_message_id_; // message identifier, up to which all notifications are removed
|
||||||
bool is_changed_ = false; // true, if the group needs to be saved to database
|
bool is_changed_ = false; // true, if the group needs to be saved to database
|
||||||
bool try_reuse_ = false; // true, if the group needs to be deleted from database and tried to be reused
|
bool try_reuse_ = false; // true, if the group needs to be deleted from database and tried to be reused
|
||||||
@ -25,7 +26,6 @@ class NotificationGroupInfo {
|
|||||||
NotificationGroupId group_id_;
|
NotificationGroupId group_id_;
|
||||||
int32 last_notification_date_ = 0; // date of last notification in the group
|
int32 last_notification_date_ = 0; // date of last notification in the group
|
||||||
NotificationId last_notification_id_; // identifier of last notification in the group
|
NotificationId last_notification_id_; // identifier of last notification in the group
|
||||||
NotificationId max_removed_notification_id_; // notification identifier, up to which all notifications are removed
|
|
||||||
|
|
||||||
NotificationGroupInfo() = default;
|
NotificationGroupInfo() = default;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user