Respect trackUnreadMessages in history jumps.

Fixes #25384.
This commit is contained in:
John Preston 2023-01-12 12:19:42 +04:00
parent 732bb25666
commit 1592f70a7c
1 changed files with 14 additions and 3 deletions

View File

@ -1960,7 +1960,9 @@ void HistoryWidget::applyCloudDraft(History *history) {
}
bool HistoryWidget::insideJumpToEndInsteadOfToUnread() const {
if (session().supportMode()) {
Expects(_history != nullptr);
if (session().supportMode() || !_history->trackUnreadMessages()) {
return true;
} else if (!_historyInited) {
return false;
@ -2193,6 +2195,10 @@ void HistoryWidget::showHistory(
} else {
_chooseForReport = nullptr;
}
if (_showAtMsgId == ShowAtUnreadMsgId
&& !_history->trackUnreadMessages()) {
_showAtMsgId = ShowAtTheEndMsgId;
}
refreshTopBarActiveChat();
updateTopBarSelection();
@ -2984,7 +2990,9 @@ void HistoryWidget::unreadCountUpdated() {
}
});
} else {
_cornerButtons.updateJumpDownVisibility(_history->isForum()
const auto hideCounter = _history->isForum()
|| !_history->trackUnreadMessages();
_cornerButtons.updateJumpDownVisibility(hideCounter
? 0
: _history->chatListBadgesState().unreadCounter);
}
@ -5899,7 +5907,10 @@ std::optional<bool> HistoryWidget::cornerButtonsDownShown() {
}
const auto haveUnreadBelowBottom = [&](History *history) {
if (!_list || !history || history->unreadCount() <= 0) {
if (!_list
|| !history
|| history->unreadCount() <= 0
|| !history->trackUnreadMessages()) {
return false;
}
const auto unread = history->firstUnreadMessage();