From 3146ccee03d88e346de8da035b07e7d691abf754 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 5 Feb 2018 03:26:04 +0300 Subject: [PATCH] Fix binlog events applying order. GitOrigin-RevId: f0e428a76e4ff0ff5f5ca99666710e0aa8ff2ee2 --- td/telegram/Td.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 6f779b19b..bdd661330 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4223,14 +4223,15 @@ Status Td::init(DbKey key) { contacts_manager_->on_binlog_user_event(std::move(event)); } - for (auto &event : events.chat_events) { - contacts_manager_->on_binlog_chat_event(std::move(event)); - } - for (auto &event : events.channel_events) { contacts_manager_->on_binlog_channel_event(std::move(event)); } + // chats may contain links to channels, so should be inited after + for (auto &event : events.chat_events) { + contacts_manager_->on_binlog_chat_event(std::move(event)); + } + for (auto &event : events.secret_chat_events) { contacts_manager_->on_binlog_secret_chat_event(std::move(event)); }