From 53219bcf70e2c4b04433dc6c5c59be8287857ec1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 20 Sep 2018 10:02:02 +0300 Subject: [PATCH] Fix two bugs with supergroup history disappearing. --- Telegram/SourceFiles/history/history.cpp | 6 +++++- Telegram/SourceFiles/history/history_inner_widget.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 5d10738348..9d30a999b7 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -2135,7 +2135,11 @@ void History::getReadyFor(MsgId msgId) { } if (!isReadyFor(msgId)) { unloadBlocks(); - + if (const auto migratePeer = peer->migrateFrom()) { + if (const auto migrated = App::historyLoaded(migratePeer)) { + migrated->unloadBlocks(); + } + } if (msgId == ShowAtTheEndMsgId) { _loadedAtBottom = true; } diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 06014c6e59..f5f98e0480 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -1945,7 +1945,7 @@ void HistoryInner::recountHistoryGeometry() { if (_migrated->blocks.back()->messages.back()->dateTime().date() == _history->blocks.front()->messages.front()->dateTime().date()) { if (_migrated->blocks.back()->messages.back()->data()->isGroupMigrate() && _history->blocks.front()->messages.front()->data()->isGroupMigrate()) { _historySkipHeight += _history->blocks.front()->messages.front()->height(); - } else { + } else if (_migrated->height() > _history->blocks.front()->messages.front()->displayedDateHeight()) { _historySkipHeight += _history->blocks.front()->messages.front()->displayedDateHeight(); } }