Update message_count_by_index even there is no message database.
This commit is contained in:
parent
11af0a058d
commit
b6d9252279
@ -9734,7 +9734,6 @@ void MessagesManager::on_get_dialog_messages_search_result(DialogId dialog_id, c
|
||||
bool from_the_end = !from_message_id.is_valid() ||
|
||||
(d->last_message_id != MessageId() && from_message_id > d->last_message_id) ||
|
||||
from_message_id >= MessageId::max();
|
||||
if (G()->parameters().use_message_db) {
|
||||
bool update_dialog = false;
|
||||
|
||||
auto &old_message_count = d->message_count_by_index[message_search_filter_index(filter)];
|
||||
@ -9748,16 +9747,16 @@ void MessagesManager::on_get_dialog_messages_search_result(DialogId dialog_id, c
|
||||
update_dialog = true;
|
||||
}
|
||||
|
||||
auto &old_first_db_message_id = d->first_database_message_id_by_index[message_search_filter_index(filter)];
|
||||
if ((from_the_end || (old_first_db_message_id.is_valid() && old_first_db_message_id <= from_message_id)) &&
|
||||
(!old_first_db_message_id.is_valid() || first_added_message_id < old_first_db_message_id)) {
|
||||
old_first_db_message_id = first_added_message_id;
|
||||
auto &old_first_database_message_id = d->first_database_message_id_by_index[message_search_filter_index(filter)];
|
||||
if ((from_the_end ||
|
||||
(old_first_database_message_id.is_valid() && old_first_database_message_id <= from_message_id)) &&
|
||||
(!old_first_database_message_id.is_valid() || first_added_message_id < old_first_database_message_id)) {
|
||||
old_first_database_message_id = first_added_message_id;
|
||||
update_dialog = true;
|
||||
}
|
||||
if (update_dialog) {
|
||||
on_dialog_updated(dialog_id, "search results");
|
||||
}
|
||||
}
|
||||
|
||||
if (from_the_end && filter == MessageSearchFilter::Pinned) {
|
||||
set_dialog_last_pinned_message_id(d, result.empty() ? MessageId() : result[0]);
|
||||
@ -9801,9 +9800,9 @@ void MessagesManager::on_get_dialog_message_count(DialogId dialog_id, MessageSea
|
||||
}
|
||||
|
||||
if (total_count == 0) {
|
||||
auto &old_first_db_message_id = d->first_database_message_id_by_index[message_search_filter_index(filter)];
|
||||
if (old_first_db_message_id != MessageId::min()) {
|
||||
old_first_db_message_id = MessageId::min();
|
||||
auto &old_first_database_message_id = d->first_database_message_id_by_index[message_search_filter_index(filter)];
|
||||
if (old_first_database_message_id != MessageId::min()) {
|
||||
old_first_database_message_id = MessageId::min();
|
||||
on_dialog_updated(dialog_id, "on_get_dialog_message_count");
|
||||
}
|
||||
if (filter == MessageSearchFilter::Pinned) {
|
||||
|
Loading…
Reference in New Issue
Block a user