From d9306e3e30ec45657b35717008c262242898ab9c Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 26 Mar 2018 00:09:45 +0400 Subject: [PATCH] Fix parent link refresh for GIF webpage preview. Fixes #4534. --- Telegram/SourceFiles/history/history_media_types.cpp | 9 +++++++++ Telegram/SourceFiles/history/history_media_types.h | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index 83d8c8fa2..f33a7205c 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -2563,6 +2563,15 @@ void HistoryGif::updateStatusText() const { } } +void HistoryGif::refreshParentId(not_null realParent) { + HistoryFileMedia::refreshParentId(realParent); + + const auto fullId = realParent->fullId(); + if (_openInMediaviewLink) { + _openInMediaviewLink->setMessageId(fullId); + } +} + QString HistoryGif::additionalInfoString() const { if (_data->isVideoMessage()) { updateStatusText(); diff --git a/Telegram/SourceFiles/history/history_media_types.h b/Telegram/SourceFiles/history/history_media_types.h index ea967e8bf..269291f6d 100644 --- a/Telegram/SourceFiles/history/history_media_types.h +++ b/Telegram/SourceFiles/history/history_media_types.h @@ -389,6 +389,8 @@ public: return MediaTypeGif; } + void refreshParentId(not_null realParent) override; + void draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const override; TextState textState(QPoint point, StateRequest request) const override; @@ -466,7 +468,7 @@ private: bool isSeparateRoundVideo() const; not_null _data; - ClickHandlerPtr _openInMediaviewLink; + FileClickHandlerPtr _openInMediaviewLink; int _thumbw = 1; int _thumbh = 1; Text _caption;