From 2054b73c3cb50750e6a4e0b6b27b3a9979a5ee56 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 23 Feb 2021 20:46:35 +0400 Subject: [PATCH] Apply date edition in service messages. --- Telegram/SourceFiles/history/history_item.cpp | 8 ++++++++ Telegram/SourceFiles/history/history_item.h | 1 + Telegram/SourceFiles/history/history_service.cpp | 1 + 3 files changed, 10 insertions(+) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 1498221ec..7c35d37ef 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -195,6 +195,14 @@ TimeId HistoryItem::NewMessageDate(TimeId scheduled) { return scheduled ? scheduled : base::unixtime::now(); } +void HistoryItem::applyServiceDateEdition(const MTPDmessageService &data) { + const auto date = data.vdate().v; + if (_date == date) { + return; + } + _date = date; +} + void HistoryItem::finishEdition(int oldKeyboardTop) { _history->owner().requestItemViewRefresh(this); invalidateChatListEntry(); diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index 9ff851a6d..960bb0f1d 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -416,6 +416,7 @@ protected: virtual void markMediaAsReadHook() { } + void applyServiceDateEdition(const MTPDmessageService &data); void finishEdition(int oldKeyboardTop); void finishEditionToEmpty(); diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index 98876178e..15bced85c 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -1045,6 +1045,7 @@ void HistoryService::applyEdition(const MTPDmessageService &message) { UpdateComponents(0); createFromMtp(message); + applyServiceDateEdition(message); if (message.vaction().type() == mtpc_messageActionHistoryClear) { removeMedia();