diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index ff54070ce..eeee7a1f0 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -730,6 +730,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_channel_public_link_copied" = "Link copied to clipboard."; "lng_forwarded" = "Forwarded from {user}"; +"lng_forwarded_date" = "Original: {date}"; "lng_forwarded_channel" = "Forwarded from {channel}"; "lng_forwarded_via" = "Forwarded from {user} via {inline_bot}"; "lng_forwarded_channel_via" = "Forwarded from {channel} via {inline_bot}"; diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 531b42ea8..b8a06dfd4 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -2416,6 +2416,9 @@ QString HistoryInner::tooltipText() const { if (auto edited = App::hoveredItem()->Get()) { dateText += '\n' + lng_edited_date(lt_date, edited->_editDate.toString(QLocale::system().dateTimeFormat(QLocale::LongFormat))); } + if (auto forwarded = App::hoveredItem()->Get()) { + dateText += '\n' + lng_forwarded_date(lt_date, forwarded->_originalDate.toString(QLocale::system().dateTimeFormat(QLocale::LongFormat))); + } return dateText; } } else if (_dragCursorState == HistoryInForwardedCursorState && _dragAction == NoDrag) { diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index f79290bb2..1ae9a99f6 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -136,6 +136,7 @@ struct HistoryMessageEdited : public RuntimeComponent { struct HistoryMessageForwarded : public RuntimeComponent { void create(const HistoryMessageVia *via) const; + QDateTime _originalDate; PeerData *_authorOriginal = nullptr; PeerData *_fromOriginal = nullptr; MsgId _originalId = 0; @@ -763,6 +764,12 @@ public: return isPost() ? history()->peer : _from; } + QDateTime dateOriginal() const { + if (auto forwarded = Get()) { + return forwarded->_originalDate; + } + return date; + } PeerData *fromOriginal() const { if (auto forwarded = Get()) { return forwarded->_fromOriginal; diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index a3185200b..939493f69 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -376,6 +376,7 @@ HistoryMessage::HistoryMessage(History *history, const MTPDmessage &msg) if (msg.has_fwd_from() && msg.vfwd_from.type() == mtpc_messageFwdHeader) { auto &f = msg.vfwd_from.c_messageFwdHeader(); + config.originalDate = ::date(f.vdate); if (f.has_from_id() || f.has_channel_id()) { config.authorIdOriginal = f.has_channel_id() ? peerFromChannel(f.vchannel_id) : peerFromUser(f.vfrom_id); config.fromIdOriginal = f.has_from_id() ? peerFromUser(f.vfrom_id) : peerFromChannel(f.vchannel_id); @@ -451,6 +452,7 @@ HistoryMessage::HistoryMessage(History *history, MsgId id, MTPDmessage::Flags fl if (fwd->Has() || !fwd->history()->peer->isSelf()) { // Server doesn't add "fwd_from" to non-forwarded messages from chat with yourself. + config.originalDate = fwd->dateOriginal(); config.authorIdOriginal = fwd->authorOriginal()->id; config.fromIdOriginal = fwd->fromOriginal()->id; if (fwd->authorOriginal()->isChannel()) { @@ -627,6 +629,7 @@ void HistoryMessage::createComponents(const CreateConfig &config) { edited->create(config.editDate, date); } if (auto forwarded = Get()) { + forwarded->_originalDate = config.originalDate; forwarded->_authorOriginal = App::peer(config.authorIdOriginal); forwarded->_fromOriginal = App::peer(config.fromIdOriginal); forwarded->_originalId = config.originalId; diff --git a/Telegram/SourceFiles/history/history_message.h b/Telegram/SourceFiles/history/history_message.h index 7096c7867..76a26936c 100644 --- a/Telegram/SourceFiles/history/history_message.h +++ b/Telegram/SourceFiles/history/history_message.h @@ -205,6 +205,7 @@ private: PeerId authorIdOriginal = 0; PeerId fromIdOriginal = 0; MsgId originalId = 0; + QDateTime originalDate; QDateTime editDate; // For messages created from MTP structs.