Do not save yet unsent message IDs as deleted message IDs.

GitOrigin-RevId: 459bc8dab615ae509da8cd2ed23832362f37f41b
This commit is contained in:
levlam 2020-04-22 14:22:33 +03:00
parent 80fb2baf6e
commit 226cf0e6dc

View File

@ -26967,20 +26967,20 @@ void MessagesManager::delete_message_from_database(Dialog *d, MessageId message_
return; return;
} }
if (message_id.is_yet_unsent()) {
return;
}
if (is_permanently_deleted) { if (is_permanently_deleted) {
if (message_id.is_scheduled() && message_id.is_scheduled_server()) { if (message_id.is_scheduled() && message_id.is_scheduled_server()) {
d->deleted_scheduled_server_message_ids.insert(message_id.get_scheduled_server_message_id()); d->deleted_scheduled_server_message_ids.insert(message_id.get_scheduled_server_message_id());
} else { } else {
if (!(td_->auth_manager_->is_bot() && m->is_failed_to_send)) { if (m == nullptr || !td_->auth_manager_->is_bot() || !m->is_failed_to_send) {
d->deleted_message_ids.insert(message_id); d->deleted_message_ids.insert(message_id);
} }
} }
} }
if (message_id.is_yet_unsent()) {
return;
}
if (m->random_id != 0 && (m->is_outgoing || d->dialog_id == get_my_dialog_id())) { if (m->random_id != 0 && (m->is_outgoing || d->dialog_id == get_my_dialog_id())) {
message_random_ids_.erase(m->random_id); message_random_ids_.erase(m->random_id);
} }