Allow service messages to be unread mentions.

This commit is contained in:
John Preston 2017-08-25 15:48:10 +03:00
parent ee5c827f26
commit 4c604b34c1
4 changed files with 10 additions and 13 deletions

View File

@ -658,6 +658,15 @@ void HistoryItem::finishEditionToEmpty() {
} }
} }
void HistoryItem::markMediaRead() {
_flags &= ~MTPDmessage::Flag::f_media_unread;
if (mentionsMe()) {
history()->updateChatListEntry();
history()->eraseFromUnreadMentions(id);
}
}
void HistoryItem::clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) { void HistoryItem::clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) {
if (auto markup = Get<HistoryMessageReplyMarkup>()) { if (auto markup = Get<HistoryMessageReplyMarkup>()) {
if (markup->inlineKeyboard) { if (markup->inlineKeyboard) {

View File

@ -577,10 +577,7 @@ public:
bool isMediaUnread() const { bool isMediaUnread() const {
return _flags & MTPDmessage::Flag::f_media_unread; return _flags & MTPDmessage::Flag::f_media_unread;
} }
void markMediaRead() { void markMediaRead();
_flags &= ~MTPDmessage::Flag::f_media_unread;
markMediaAsReadHook();
}
// Zero result means this message is not self-destructing right now. // Zero result means this message is not self-destructing right now.
virtual TimeMs getSelfDestructIn(TimeMs now) { virtual TimeMs getSelfDestructIn(TimeMs now) {

View File

@ -1233,13 +1233,6 @@ void HistoryMessage::applyEditionToEmpty() {
finishEditionToEmpty(); finishEditionToEmpty();
} }
void HistoryMessage::markMediaAsReadHook() {
if (mentionsMe()) {
history()->updateChatListEntry();
history()->eraseFromUnreadMentions(id);
}
}
bool HistoryMessage::displayForwardedFrom() const { bool HistoryMessage::displayForwardedFrom() const {
if (auto forwarded = Get<HistoryMessageForwarded>()) { if (auto forwarded = Get<HistoryMessageForwarded>()) {
return Has<HistoryMessageVia>() return Has<HistoryMessageVia>()

View File

@ -166,8 +166,6 @@ private:
int performResizeGetHeight(); int performResizeGetHeight();
void applyEditionToEmpty(); void applyEditionToEmpty();
void markMediaAsReadHook() override;
bool displayForwardedFrom() const; bool displayForwardedFrom() const;
void paintFromName(Painter &p, QRect &trect, bool selected) const; void paintFromName(Painter &p, QRect &trect, bool selected) const;
void paintForwardedInfo(Painter &p, QRect &trect, bool selected) const; void paintForwardedInfo(Painter &p, QRect &trect, bool selected) const;