Attempted to fix rare non-elided text in bar of pinned bot messages.

This commit is contained in:
23rd 2022-09-01 23:29:41 +03:00 committed by John Preston
parent fa6b4f9b52
commit 49773dde72

View file

@ -6417,8 +6417,7 @@ void HistoryWidget::checkPinnedBarState() {
return controller()->isGifPausedAtLeastFor( return controller()->isGifPausedAtLeastFor(
Window::GifPauseReason::Any); Window::GifPauseReason::Any);
}); });
rpl::combine( auto pinnedRefreshed = Info::Profile::SharedMediaCountValue(
Info::Profile::SharedMediaCountValue(
_peer, _peer,
nullptr, nullptr,
Storage::SharedMediaType::Pinned Storage::SharedMediaType::Pinned
@ -6430,18 +6429,27 @@ void HistoryWidget::checkPinnedBarState() {
updatePinnedViewer(); updatePinnedViewer();
} }
return (count > 1); return (count > 1);
}) | rpl::distinct_until_changed(), }) | rpl::distinct_until_changed();
HistoryView::PinnedBarItemWithReplyMarkup( auto markupRefreshed = HistoryView::PinnedBarItemWithReplyMarkup(
&session(), &session(),
_pinnedTracker->shownMessageId()) _pinnedTracker->shownMessageId());
rpl::combine(
rpl::duplicate(pinnedRefreshed),
rpl::duplicate(markupRefreshed)
) | rpl::start_with_next([=](bool many, HistoryItem *item) { ) | rpl::start_with_next([=](bool many, HistoryItem *item) {
refreshPinnedBarButton(many, item); refreshPinnedBarButton(many, item);
}, _pinnedBar->lifetime()); }, _pinnedBar->lifetime());
_pinnedBar->setContent(HistoryView::PinnedBarContent( _pinnedBar->setContent(rpl::combine(
HistoryView::PinnedBarContent(
&session(), &session(),
_pinnedTracker->shownMessageId(), _pinnedTracker->shownMessageId(),
[bar = _pinnedBar.get()] { bar->customEmojiRepaint(); })); [bar = _pinnedBar.get()] { bar->customEmojiRepaint(); }),
std::move(pinnedRefreshed),
std::move(markupRefreshed)
) | rpl::map([](Ui::MessageBarContent &&content, bool, HistoryItem*) {
return std::move(content);
}));
controller()->adaptive().oneColumnValue( controller()->adaptive().oneColumnValue(
) | rpl::start_with_next([=](bool one) { ) | rpl::start_with_next([=](bool one) {