Fix two bugs with supergroup history disappearing.

This commit is contained in:
John Preston 2018-09-20 10:02:02 +03:00
parent 81f9c70279
commit 53219bcf70
2 changed files with 6 additions and 2 deletions

View File

@ -2135,7 +2135,11 @@ void History::getReadyFor(MsgId msgId) {
} }
if (!isReadyFor(msgId)) { if (!isReadyFor(msgId)) {
unloadBlocks(); unloadBlocks();
if (const auto migratePeer = peer->migrateFrom()) {
if (const auto migrated = App::historyLoaded(migratePeer)) {
migrated->unloadBlocks();
}
}
if (msgId == ShowAtTheEndMsgId) { if (msgId == ShowAtTheEndMsgId) {
_loadedAtBottom = true; _loadedAtBottom = true;
} }

View File

@ -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()->dateTime().date() == _history->blocks.front()->messages.front()->dateTime().date()) {
if (_migrated->blocks.back()->messages.back()->data()->isGroupMigrate() && _history->blocks.front()->messages.front()->data()->isGroupMigrate()) { if (_migrated->blocks.back()->messages.back()->data()->isGroupMigrate() && _history->blocks.front()->messages.front()->data()->isGroupMigrate()) {
_historySkipHeight += _history->blocks.front()->messages.front()->height(); _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(); _historySkipHeight += _history->blocks.front()->messages.front()->displayedDateHeight();
} }
} }