diff --git a/Telegram/SourceFiles/data/data_pinned_messages.cpp b/Telegram/SourceFiles/data/data_pinned_messages.cpp index c1121df8a6..518be33ff8 100644 --- a/Telegram/SourceFiles/data/data_pinned_messages.cpp +++ b/Telegram/SourceFiles/data/data_pinned_messages.cpp @@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "storage/storage_facade.h" #include "storage/storage_shared_media.h" +#include "data/data_shared_media.h" +#include "data/data_sparse_ids.h" namespace Data { namespace { @@ -44,17 +46,21 @@ MsgId PinnedMessages::topId() const { rpl::producer PinnedMessages::viewer( MsgId aroundId, int limit) const { - return _storage.query( - SharedMediaQuery( - SharedMediaKey(_peer->id, PinnedType, aroundId), - limit, - limit) - ) | rpl::map([](const SharedMediaResult &result) { + return SharedMediaViewer( + &_peer->session(), + SharedMediaKey(_peer->id, PinnedType, aroundId), + limit, + limit + ) | rpl::map([](const SparseIdsSlice &result) { auto data = PinnedAroundId(); - data.fullCount = result.count; - data.skippedBefore = result.skippedBefore; - data.skippedAfter = result.skippedAfter; - data.ids = result.messageIds | ranges::to_vector; + data.fullCount = result.fullCount(); + data.skippedBefore = result.skippedBefore(); + data.skippedAfter = result.skippedAfter(); + const auto count = result.size(); + data.ids.reserve(count); + for (auto i = 0; i != count; ++i) { + data.ids.push_back(result[i]); + } return data; }); } diff --git a/Telegram/SourceFiles/ui/chat/message_bar.cpp b/Telegram/SourceFiles/ui/chat/message_bar.cpp index 42ccc6f1c6..7972583cbe 100644 --- a/Telegram/SourceFiles/ui/chat/message_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/message_bar.cpp @@ -435,6 +435,7 @@ void MessageBar::paintLeftBar(Painter &p) { st::msgInReplyBarColor->c.alpha() / 3)); const auto radius = line / 2.; auto hq = PainterHighQualityEnabler(p); + p.setClipRect(bar.x(), 0, bar.width(), fullHeight); for (auto i = paintFrom; i != paintTill; ++i) { const auto top = i * single - scroll; const auto bottom = top + state.size; @@ -454,6 +455,7 @@ void MessageBar::paintLeftBar(Painter &p) { radius, radius); } + p.setClipping(false); if (_content.count > 4) { const auto firstScroll = countBarState(2).scroll; const auto gradientTop = (scroll >= firstScroll)