diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 5248ef8f..b0d9cfb2 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -18152,7 +18152,8 @@ void MessagesManager::on_send_message_fail(int64 random_id, Status error) { MessageId MessagesManager::get_next_message_id(Dialog *d, int32 type) { CHECK(d != nullptr); int64 last = std::max({d->last_message_id.get(), d->last_new_message_id.get(), d->last_database_message_id.get(), - d->last_assigned_message_id.get()}); + d->last_assigned_message_id.get(), d->last_clear_history_message_id.get(), + d->deleted_last_message_id.get(), d->max_unavailable_message_id.get()}); if (last < d->last_read_inbox_message_id.get() && d->last_read_inbox_message_id.get() < d->last_new_message_id.get() + MessageId::FULL_TYPE_MASK) { last = d->last_read_inbox_message_id.get();