Fix secret chat notification settings init.
GitOrigin-RevId: 3e8891b287bdda1ea9e39400e44d9f477ba8dc58
This commit is contained in:
parent
6c1173d611
commit
52a250456a
@ -22998,18 +22998,19 @@ void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source
|
||||
if (d == nullptr) {
|
||||
LOG(INFO) << "Force create " << dialog_id << " from " << source;
|
||||
if (loaded_dialogs_.count(dialog_id) > 0) {
|
||||
LOG(INFO) << "Skip creation of " << dialog_id << ", because it is being loaded now";
|
||||
return;
|
||||
}
|
||||
|
||||
d = add_dialog(dialog_id);
|
||||
update_dialog_pos(d, false, "force_create_dialog");
|
||||
|
||||
if (dialog_id.get_type() == DialogType::SecretChat) {
|
||||
if (dialog_id.get_type() == DialogType::SecretChat && !d->notification_settings.is_synchronized) {
|
||||
// secret chat is being created
|
||||
// let's copy notification settings from main chat if available
|
||||
VLOG(notifications) << "Create new secret " << dialog_id << " from " << source;
|
||||
auto secret_chat_id = dialog_id.get_secret_chat_id();
|
||||
if (!d->notification_settings.is_synchronized) {
|
||||
{
|
||||
auto user_id = td_->contacts_manager_->get_secret_chat_user_id(secret_chat_id);
|
||||
Dialog *user_d = get_dialog_force(DialogId(user_id));
|
||||
if (user_d != nullptr && user_d->notification_settings.is_synchronized) {
|
||||
@ -23019,6 +23020,9 @@ void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source
|
||||
new_notification_settings.show_preview = false;
|
||||
new_notification_settings.is_secret_chat_show_preview_fixed = true;
|
||||
update_dialog_notification_settings(dialog_id, &d->notification_settings, new_notification_settings);
|
||||
} else {
|
||||
d->notification_settings.is_synchronized = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (G()->parameters().use_message_db && !td_->auth_manager_->is_bot() &&
|
||||
@ -23032,8 +23036,7 @@ void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source
|
||||
d->new_secret_chat_notification_id = get_next_notification_id(d, notification_group_id, MessageId());
|
||||
if (d->new_secret_chat_notification_id.is_valid()) {
|
||||
auto date = td_->contacts_manager_->get_secret_chat_date(secret_chat_id);
|
||||
bool is_changed =
|
||||
set_dialog_last_notification(dialog_id, d->message_notification_group, date,
|
||||
bool is_changed = set_dialog_last_notification(dialog_id, d->message_notification_group, date,
|
||||
d->new_secret_chat_notification_id, "add_new_secret_chat");
|
||||
CHECK(is_changed);
|
||||
VLOG(notifications) << "Create " << d->new_secret_chat_notification_id << " with " << secret_chat_id;
|
||||
@ -23044,9 +23047,6 @@ void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG(ERROR) << "Found previously created secret " << d->dialog_id << ", when creating it from " << source;
|
||||
}
|
||||
}
|
||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
if (!have_dialog_info(dialog_id)) {
|
||||
@ -23140,7 +23140,6 @@ MessagesManager::Dialog *MessagesManager::add_new_dialog(unique_ptr<Dialog> &&d,
|
||||
d->need_restore_reply_markup = false;
|
||||
d->is_last_read_inbox_message_id_inited = true;
|
||||
d->is_last_read_outbox_message_id_inited = true;
|
||||
d->notification_settings.is_synchronized = true;
|
||||
d->know_can_report_spam = true;
|
||||
d->is_pinned_message_id_inited = true;
|
||||
if (!is_loaded_from_database) {
|
||||
|
Loading…
Reference in New Issue
Block a user