Remove read history delay when there is no more messages to read.

GitOrigin-RevId: 08ec35c839c35bb33ea4e3bc5063e08b0f8c6cc0
This commit is contained in:
levlam 2018-06-19 03:35:09 +03:00
parent 4d5197d31c
commit 537d96cc8e

View File

@ -13804,8 +13804,8 @@ void MessagesManager::read_history_on_server(Dialog *d, MessageId max_message_id
d->read_history_logevent_id_generation++;
}
pending_read_history_timeout_.set_timeout_in(
dialog_id.get(), d->is_opened && dialog_id.get_type() != DialogType::SecretChat ? MIN_READ_HISTORY_DELAY : 0);
bool need_delay = d->is_opened && dialog_id.get_type() != DialogType::SecretChat && d->server_unread_count > 0;
pending_read_history_timeout_.set_timeout_in(dialog_id.get(), need_delay ? MIN_READ_HISTORY_DELAY : 0);
}
void MessagesManager::read_history_on_server_impl(DialogId dialog_id, MessageId max_message_id) {