mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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)
|
const auto chosen = (history->peer->id == peerId)
|
||||||
? history
|
? history
|
||||||
: history->owner().history(peerId);
|
: history->owner().history(peerId);
|
||||||
return HistoryViewer(history, simpleKey, limitBefore, limitAfter);
|
return HistoryViewer(chosen, simpleKey, limitBefore, limitAfter);
|
||||||
};
|
};
|
||||||
const auto peerId = history->peer->id;
|
const auto peerId = history->peer->id;
|
||||||
const auto topicRootId = MsgId();
|
const auto topicRootId = MsgId();
|
||||||
|
|
|
@ -3107,8 +3107,9 @@ Data::HistoryMessages &History::messages() {
|
||||||
if (!_messages) {
|
if (!_messages) {
|
||||||
_messages = std::make_unique<Data::HistoryMessages>();
|
_messages = std::make_unique<Data::HistoryMessages>();
|
||||||
|
|
||||||
|
const auto max = maxMsgId();
|
||||||
const auto from = loadedAtTop() ? 0 : minMsgId();
|
const auto from = loadedAtTop() ? 0 : minMsgId();
|
||||||
const auto till = loadedAtBottom() ? ServerMaxMsgId : maxMsgId();
|
const auto till = loadedAtBottom() ? ServerMaxMsgId : max;
|
||||||
auto list = std::vector<MsgId>();
|
auto list = std::vector<MsgId>();
|
||||||
list.reserve(std::min(
|
list.reserve(std::min(
|
||||||
int(_items.size()),
|
int(_items.size()),
|
||||||
|
@ -3122,13 +3123,14 @@ Data::HistoryMessages &History::messages() {
|
||||||
if (!list.empty() && list.back() >= id) {
|
if (!list.empty() && list.back() >= id) {
|
||||||
sort = true;
|
sort = true;
|
||||||
}
|
}
|
||||||
|
list.push_back(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sort) {
|
if (sort) {
|
||||||
ranges::sort(list);
|
ranges::sort(list);
|
||||||
}
|
}
|
||||||
if (till) {
|
if (max || (loadedAtTop() && loadedAtBottom())) {
|
||||||
_messages->addSlice(std::move(list), { from, till }, {});
|
_messages->addSlice(std::move(list), { from, till }, {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue