Fix removing new secret chat notification.
GitOrigin-RevId: 8be89f32889e6622e41232b206613a39a4f25080
This commit is contained in:
parent
8bc3ff622f
commit
26ba56ffca
@ -5726,7 +5726,7 @@ bool MessagesManager::update_dialog_notification_settings(DialogId dialog_id,
|
||||
*current_settings = new_settings;
|
||||
|
||||
if (!was_muted && is_dialog_muted(d)) {
|
||||
remove_all_dialog_notifications(dialog_id, d->message_notification_group, "save_scope_notification_settings");
|
||||
remove_all_dialog_notifications(d, d->message_notification_group, "save_scope_notification_settings");
|
||||
}
|
||||
if (is_dialog_pinned_message_notifications_disabled(d) && d->mention_notification_group.group_id.is_valid() &&
|
||||
d->pinned_message_notification_message_id.is_valid()) {
|
||||
@ -18909,18 +18909,22 @@ void MessagesManager::flush_pending_new_message_notifications(DialogId dialog_id
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesManager::remove_all_dialog_notifications(DialogId dialog_id, NotificationGroupInfo &group_info,
|
||||
void MessagesManager::remove_all_dialog_notifications(Dialog *d, NotificationGroupInfo &group_info,
|
||||
const char *source) {
|
||||
// removes up to group_info.last_notification_id
|
||||
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) {
|
||||
VLOG(notifications) << "Set max_removed_notification_id in " << group_info.group_id << '/' << dialog_id << " to "
|
||||
VLOG(notifications) << "Set max_removed_notification_id in " << group_info.group_id << '/' << d->dialog_id << " to "
|
||||
<< group_info.last_notification_id << " from " << source;
|
||||
group_info.max_removed_notification_id = group_info.last_notification_id;
|
||||
send_closure_later(G()->notification_manager(), &NotificationManager::remove_notification_group,
|
||||
group_info.group_id, group_info.last_notification_id, MessageId(), 0, Promise<Unit>());
|
||||
bool is_changed = set_dialog_last_notification(dialog_id, group_info, 0, NotificationId(), source);
|
||||
CHECK(is_changed);
|
||||
if (d->new_secret_chat_notification_id.is_valid() && &group_info == &d->message_notification_group) {
|
||||
remove_new_secret_chat_notification(d, false);
|
||||
} else {
|
||||
bool is_changed = set_dialog_last_notification(d->dialog_id, group_info, 0, NotificationId(), source);
|
||||
CHECK(is_changed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23191,6 +23195,11 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
||||
VLOG(notifications) << "Remove disabled pinned message notification in " << dialog_id;
|
||||
remove_dialog_pinned_message_notification(d);
|
||||
}
|
||||
if (d->new_secret_chat_notification_id.is_valid() &&
|
||||
d->new_secret_chat_notification_id.get() <= d->message_notification_group.max_removed_notification_id.get()) {
|
||||
VLOG(notifications) << "Fix removing new secret chat " << d->new_secret_chat_notification_id << " in " << dialog_id;
|
||||
d->new_secret_chat_notification_id = NotificationId();
|
||||
}
|
||||
|
||||
auto pending_it = pending_add_dialog_last_database_message_dependent_dialogs_.find(dialog_id);
|
||||
if (pending_it != pending_add_dialog_last_database_message_dependent_dialogs_.end()) {
|
||||
@ -23649,8 +23658,8 @@ bool MessagesManager::set_dialog_order(Dialog *d, int64 new_order, bool need_sen
|
||||
channel_get_difference_retry_timeout_.add_timeout_in(dialog_id.get(), 0.001);
|
||||
}
|
||||
if (dialog_type == DialogType::Channel && !has_unread_counter) {
|
||||
remove_all_dialog_notifications(dialog_id, d->message_notification_group, "set_dialog_order 1");
|
||||
remove_all_dialog_notifications(dialog_id, d->mention_notification_group, "set_dialog_order 2");
|
||||
remove_all_dialog_notifications(d, d->message_notification_group, "set_dialog_order 1");
|
||||
remove_all_dialog_notifications(d, d->mention_notification_group, "set_dialog_order 2");
|
||||
clear_active_dialog_actions(dialog_id);
|
||||
}
|
||||
}
|
||||
@ -23666,8 +23675,8 @@ bool MessagesManager::set_dialog_order(Dialog *d, int64 new_order, bool need_sen
|
||||
send_update_chat_is_sponsored(d);
|
||||
if (!is_loaded_from_database && is_sponsored) {
|
||||
// channel is sponsored only if user isn't a channel member
|
||||
remove_all_dialog_notifications(dialog_id, d->message_notification_group, "set_dialog_order 3");
|
||||
remove_all_dialog_notifications(dialog_id, d->mention_notification_group, "set_dialog_order 4");
|
||||
remove_all_dialog_notifications(d, d->message_notification_group, "set_dialog_order 3");
|
||||
remove_all_dialog_notifications(d, d->mention_notification_group, "set_dialog_order 4");
|
||||
}
|
||||
need_update = false;
|
||||
}
|
||||
|
@ -1616,7 +1616,7 @@ class MessagesManager : public Actor {
|
||||
|
||||
void flush_pending_new_message_notifications(DialogId dialog_id, bool from_mentions, DialogId settings_dialog_id);
|
||||
|
||||
void remove_all_dialog_notifications(DialogId dialog_id, NotificationGroupInfo &group_info, const char *source);
|
||||
void remove_all_dialog_notifications(Dialog *d, NotificationGroupInfo &group_info, const char *source);
|
||||
|
||||
void remove_all_dialog_notifications(Dialog *d, MessageId max_message_id, NotificationGroupInfo &group_info,
|
||||
const char *source);
|
||||
|
Loading…
Reference in New Issue
Block a user