2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-10-15 14:08:05 +00:00

Fix opening Replies section on unread bar.

This commit is contained in:
John Preston
2020-10-02 19:26:04 +03:00
parent 8d70a62ee8
commit 4b6d74dd9b
7 changed files with 45 additions and 10 deletions

View File

@@ -479,9 +479,15 @@ void MessagesSliceBuilder::requestMessagesCount() {
MessagesSlice MessagesSliceBuilder::snapshot() const {
auto result = MessagesSlice();
result.ids.reserve(_ids.size());
auto nearestToAround = std::optional<FullMsgId>();
for (const auto &position : _ids) {
result.ids.push_back(position.fullId);
if (!nearestToAround && position >= _key) {
nearestToAround = position.fullId;
}
}
result.nearestToAround = nearestToAround.value_or(
_ids.empty() ? FullMsgId() : _ids.back().fullId);
result.skippedBefore = _skippedBefore;
result.skippedAfter = _skippedAfter;
result.fullCount = _fullCount;