mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Fix migrated history in chat preview.
This commit is contained in:
parent
0f524ac67d
commit
aee62c7591
2 changed files with 5 additions and 3 deletions
|
@ -151,7 +151,7 @@ rpl::producer<SparseIdsMergedSlice> HistoryMergedViewer(
|
|||
const auto chosen = (history->peer->id == peerId)
|
||||
? history
|
||||
: history->owner().history(peerId);
|
||||
return HistoryViewer(history, simpleKey, limitBefore, limitAfter);
|
||||
return HistoryViewer(chosen, simpleKey, limitBefore, limitAfter);
|
||||
};
|
||||
const auto peerId = history->peer->id;
|
||||
const auto topicRootId = MsgId();
|
||||
|
|
|
@ -3107,8 +3107,9 @@ Data::HistoryMessages &History::messages() {
|
|||
if (!_messages) {
|
||||
_messages = std::make_unique<Data::HistoryMessages>();
|
||||
|
||||
const auto max = maxMsgId();
|
||||
const auto from = loadedAtTop() ? 0 : minMsgId();
|
||||
const auto till = loadedAtBottom() ? ServerMaxMsgId : maxMsgId();
|
||||
const auto till = loadedAtBottom() ? ServerMaxMsgId : max;
|
||||
auto list = std::vector<MsgId>();
|
||||
list.reserve(std::min(
|
||||
int(_items.size()),
|
||||
|
@ -3122,13 +3123,14 @@ Data::HistoryMessages &History::messages() {
|
|||
if (!list.empty() && list.back() >= id) {
|
||||
sort = true;
|
||||
}
|
||||
list.push_back(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sort) {
|
||||
ranges::sort(list);
|
||||
}
|
||||
if (till) {
|
||||
if (max || (loadedAtTop() && loadedAtBottom())) {
|
||||
_messages->addSlice(std::move(list), { from, till }, {});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue