From 01a1538570abd29406984175948b25a0aa2e3804 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 5 Jun 2019 03:48:49 +0300 Subject: [PATCH] Clear *_database_message_id when receive no messages from the database. GitOrigin-RevId: 9c43ed5052a3c389de78573b3fa58a2a10c40572 --- td/telegram/MessagesManager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 0cf06aac..e73b8dd8 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -14951,8 +14951,13 @@ void MessagesManager::on_get_history_from_database(DialogId dialog_id, MessageId << " with offset " << offset << " and limit " << limit << ". First database message is " << d->first_database_message_id << ", have_full_history = " << d->have_full_history; - if (messages.empty() && from_the_end && d->have_full_history && d->messages == nullptr) { - set_dialog_is_empty(d, "on_get_history_from_database empty"); + if (messages.empty() && from_the_end && d->messages == nullptr) { + if (d->have_full_history) { + set_dialog_is_empty(d, "on_get_history_from_database empty"); + } else if (d->last_database_message_id.is_valid()) { + set_dialog_first_database_message_id(d, MessageId(), "on_get_history_from_database empty"); + set_dialog_last_database_message_id(d, MessageId(), "on_get_history_from_database empty"); + } } bool have_next = false;