From 4102551108c750fbf34680669259de579fe18b51 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 16 Dec 2019 03:20:25 +0300 Subject: [PATCH] Fixed covering message status with mentions button at end. --- .../SourceFiles/history/history_widget.cpp | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 51b34adde7..cfd0a7a25a 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2738,6 +2738,7 @@ void HistoryWidget::preloadHistoryIfNeeded() { } updateHistoryDownVisibility(); + updateUnreadMentionsVisibility(); if (!_scrollToAnimation.animating()) { preloadHistoryByScroll(); checkReplyReturns(); @@ -5402,13 +5403,24 @@ void HistoryWidget::updateUnreadMentionsVisibility() { if (showUnreadMentions) { session().api().preloadEnoughUnreadMentions(_history); } - auto unreadMentionsIsVisible = [this, showUnreadMentions] { + const auto unreadMentionsIsShown = [&] { if (!showUnreadMentions || _firstLoadRequest) { return false; } - return (_history->getUnreadMentionsLoadedCount() > 0); - }; - auto unreadMentionsIsShown = unreadMentionsIsVisible(); + if (!_history->getUnreadMentionsLoadedCount()) { + return false; + } + // If we have an unheard voice message with the mention + // and our message is the last one, we can't see the status + // (delivered/read) of this message. + // (Except for MacBooks with the TouchPad.) + if (_scroll->scrollTop() == _scroll->scrollTopMax()) { + if (const auto lastMessage = _history->lastMessage()) { + return !lastMessage->from()->isSelf(); + } + } + return true; + }(); if (unreadMentionsIsShown) { _unreadMentions->setUnreadCount(_history->getUnreadMentionsCount()); }