mirror of https://github.com/procxx/kepka.git
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() {
|
MsgId History::readInbox() {
|
||||||
const auto upTo = msgIdForRead();
|
const auto upTo = msgIdForRead();
|
||||||
setUnreadCount(0);
|
setUnreadCount(0);
|
||||||
|
readClientSideMessages();
|
||||||
if (upTo) {
|
if (upTo) {
|
||||||
inboxRead(upTo);
|
inboxRead(upTo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -426,6 +426,7 @@ private:
|
||||||
|
|
||||||
void setInboxReadTill(MsgId upTo);
|
void setInboxReadTill(MsgId upTo);
|
||||||
void setOutboxReadTill(MsgId upTo);
|
void setOutboxReadTill(MsgId upTo);
|
||||||
|
void readClientSideMessages();
|
||||||
|
|
||||||
void applyMessageChanges(
|
void applyMessageChanges(
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
|
|
|
@ -659,6 +659,10 @@ bool HistoryItem::unread() const {
|
||||||
return (_flags & MTPDmessage_ClientFlag::f_clientside_unread);
|
return (_flags & MTPDmessage_ClientFlag::f_clientside_unread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryItem::markClientSideAsRead() {
|
||||||
|
_flags &= ~MTPDmessage_ClientFlag::f_clientside_unread;
|
||||||
|
}
|
||||||
|
|
||||||
MessageGroupId HistoryItem::groupId() const {
|
MessageGroupId HistoryItem::groupId() const {
|
||||||
return _groupId;
|
return _groupId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,16 +111,17 @@ public:
|
||||||
void removeMainView();
|
void removeMainView();
|
||||||
|
|
||||||
void destroy();
|
void destroy();
|
||||||
bool out() const {
|
[[nodiscard]] bool out() const {
|
||||||
return _flags & MTPDmessage::Flag::f_out;
|
return _flags & MTPDmessage::Flag::f_out;
|
||||||
}
|
}
|
||||||
bool unread() const;
|
[[nodiscard]] bool unread() const;
|
||||||
bool mentionsMe() const {
|
void markClientSideAsRead();
|
||||||
|
[[nodiscard]] bool mentionsMe() const {
|
||||||
return _flags & MTPDmessage::Flag::f_mentioned;
|
return _flags & MTPDmessage::Flag::f_mentioned;
|
||||||
}
|
}
|
||||||
bool isUnreadMention() const;
|
[[nodiscard]] bool isUnreadMention() const;
|
||||||
bool isUnreadMedia() const;
|
[[nodiscard]] bool isUnreadMedia() const;
|
||||||
bool hasUnreadMediaFlag() const;
|
[[nodiscard]] bool hasUnreadMediaFlag() const;
|
||||||
void markMediaRead();
|
void markMediaRead();
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,7 +130,7 @@ public:
|
||||||
void savePreviousMedia() {
|
void savePreviousMedia() {
|
||||||
_savedMedia = _media->clone(this);
|
_savedMedia = _media->clone(this);
|
||||||
}
|
}
|
||||||
bool isEditingMedia() const {
|
[[nodiscard]] bool isEditingMedia() const {
|
||||||
return _savedMedia != nullptr;
|
return _savedMedia != nullptr;
|
||||||
}
|
}
|
||||||
void clearSavedMedia() {
|
void clearSavedMedia() {
|
||||||
|
|
Loading…
Reference in New Issue