From 4c604b34c174de8090baf738af36e088cacd2025 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 25 Aug 2017 15:48:10 +0300 Subject: [PATCH] Allow service messages to be unread mentions. --- Telegram/SourceFiles/history/history_item.cpp | 9 +++++++++ Telegram/SourceFiles/history/history_item.h | 5 +---- Telegram/SourceFiles/history/history_message.cpp | 7 ------- Telegram/SourceFiles/history/history_message.h | 2 -- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 5c0c5d1b5..de972840d 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -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) { if (auto markup = Get()) { if (markup->inlineKeyboard) { diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index 6e058fffe..d34ed37e8 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -577,10 +577,7 @@ public: bool isMediaUnread() const { return _flags & MTPDmessage::Flag::f_media_unread; } - void markMediaRead() { - _flags &= ~MTPDmessage::Flag::f_media_unread; - markMediaAsReadHook(); - } + void markMediaRead(); // Zero result means this message is not self-destructing right now. virtual TimeMs getSelfDestructIn(TimeMs now) { diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index b8196d30a..98ee11fef 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -1233,13 +1233,6 @@ void HistoryMessage::applyEditionToEmpty() { finishEditionToEmpty(); } -void HistoryMessage::markMediaAsReadHook() { - if (mentionsMe()) { - history()->updateChatListEntry(); - history()->eraseFromUnreadMentions(id); - } -} - bool HistoryMessage::displayForwardedFrom() const { if (auto forwarded = Get()) { return Has() diff --git a/Telegram/SourceFiles/history/history_message.h b/Telegram/SourceFiles/history/history_message.h index 0ef8c76b4..39fafd0bd 100644 --- a/Telegram/SourceFiles/history/history_message.h +++ b/Telegram/SourceFiles/history/history_message.h @@ -166,8 +166,6 @@ private: int performResizeGetHeight(); void applyEditionToEmpty(); - void markMediaAsReadHook() override; - bool displayForwardedFrom() const; void paintFromName(Painter &p, QRect &trect, bool selected) const; void paintForwardedInfo(Painter &p, QRect &trect, bool selected) const;