mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Fix reading of client side unread messages.
This commit is contained in:
parent
c9552390e7
commit
39008bf6fe
@ -1540,9 +1540,21 @@ void History::calculateFirstUnreadMessage() {
|
||||
}
|
||||
}
|
||||
|
||||
void History::readClientSideMessages() {
|
||||
for (const auto &block : blocks) {
|
||||
for (const auto &view : block->messages) {
|
||||
const auto item = view->data();
|
||||
if (!item->out()) {
|
||||
item->markClientSideAsRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MsgId History::readInbox() {
|
||||
const auto upTo = msgIdForRead();
|
||||
setUnreadCount(0);
|
||||
readClientSideMessages();
|
||||
if (upTo) {
|
||||
inboxRead(upTo);
|
||||
}
|
||||
|
@ -426,6 +426,7 @@ private:
|
||||
|
||||
void setInboxReadTill(MsgId upTo);
|
||||
void setOutboxReadTill(MsgId upTo);
|
||||
void readClientSideMessages();
|
||||
|
||||
void applyMessageChanges(
|
||||
not_null<HistoryItem*> item,
|
||||
|
@ -659,6 +659,10 @@ bool HistoryItem::unread() const {
|
||||
return (_flags & MTPDmessage_ClientFlag::f_clientside_unread);
|
||||
}
|
||||
|
||||
void HistoryItem::markClientSideAsRead() {
|
||||
_flags &= ~MTPDmessage_ClientFlag::f_clientside_unread;
|
||||
}
|
||||
|
||||
MessageGroupId HistoryItem::groupId() const {
|
||||
return _groupId;
|
||||
}
|
||||
|
@ -111,16 +111,17 @@ public:
|
||||
void removeMainView();
|
||||
|
||||
void destroy();
|
||||
bool out() const {
|
||||
[[nodiscard]] bool out() const {
|
||||
return _flags & MTPDmessage::Flag::f_out;
|
||||
}
|
||||
bool unread() const;
|
||||
bool mentionsMe() const {
|
||||
[[nodiscard]] bool unread() const;
|
||||
void markClientSideAsRead();
|
||||
[[nodiscard]] bool mentionsMe() const {
|
||||
return _flags & MTPDmessage::Flag::f_mentioned;
|
||||
}
|
||||
bool isUnreadMention() const;
|
||||
bool isUnreadMedia() const;
|
||||
bool hasUnreadMediaFlag() const;
|
||||
[[nodiscard]] bool isUnreadMention() const;
|
||||
[[nodiscard]] bool isUnreadMedia() const;
|
||||
[[nodiscard]] bool hasUnreadMediaFlag() const;
|
||||
void markMediaRead();
|
||||
|
||||
|
||||
@ -129,7 +130,7 @@ public:
|
||||
void savePreviousMedia() {
|
||||
_savedMedia = _media->clone(this);
|
||||
}
|
||||
bool isEditingMedia() const {
|
||||
[[nodiscard]] bool isEditingMedia() const {
|
||||
return _savedMedia != nullptr;
|
||||
}
|
||||
void clearSavedMedia() {
|
||||
|
Loading…
Reference in New Issue
Block a user