mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Don't read history for guest channels.
This commit is contained in:
parent
a954b459b4
commit
9bdcd08233
@ -135,6 +135,8 @@ void Histories::readInboxTill(
|
||||
|
||||
if (!history->readInboxTillNeedsRequest(tillId) && !force) {
|
||||
return;
|
||||
} else if (!history->trackUnreadMessages()) {
|
||||
return;
|
||||
} else if (!force) {
|
||||
const auto maybeState = lookup(history);
|
||||
if (maybeState && maybeState->readTill >= tillId) {
|
||||
|
@ -1595,7 +1595,7 @@ void History::calculateFirstUnreadMessage() {
|
||||
}
|
||||
|
||||
_firstUnreadView = nullptr;
|
||||
if (!unreadCount()) {
|
||||
if (!unreadCount() || !trackUnreadMessages()) {
|
||||
return;
|
||||
}
|
||||
for (const auto &block : ranges::view::reverse(blocks)) {
|
||||
@ -2575,6 +2575,13 @@ int History::fixedOnTopIndex() const {
|
||||
return useProxyPromotion() ? kProxyPromotionFixOnTopIndex : 0;
|
||||
}
|
||||
|
||||
bool History::trackUnreadMessages() const {
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
return channel->amIn();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool History::shouldBeInChatList() const {
|
||||
if (peer->migrateTo() || !folderKnown()) {
|
||||
return false;
|
||||
|
@ -191,6 +191,7 @@ public:
|
||||
not_null<const HistoryItem*> item) const;
|
||||
[[nodiscard]] MsgId loadAroundId() const;
|
||||
|
||||
[[nodiscard]] bool trackUnreadMessages() const;
|
||||
[[nodiscard]] int unreadCount() const;
|
||||
[[nodiscard]] bool unreadCountKnown() const;
|
||||
|
||||
|
@ -5212,7 +5212,7 @@ void HistoryWidget::addMessagesToBack(
|
||||
PeerData *peer,
|
||||
const QVector<MTPMessage> &messages) {
|
||||
const auto checkForUnreadStart = [&] {
|
||||
if (_history->unreadBar() || !_history->inChatList()) {
|
||||
if (_history->unreadBar() || !_history->trackUnreadMessages()) {
|
||||
return false;
|
||||
}
|
||||
_history->calculateFirstUnreadMessage();
|
||||
|
Loading…
Reference in New Issue
Block a user