Fixed covering message status with mentions button at end.

This commit is contained in:
23rd 2019-12-16 03:20:25 +03:00 committed by John Preston
parent ff4ccdc59c
commit 4102551108
1 changed files with 16 additions and 4 deletions

View File

@ -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());
}