From 743743ca10fb6c565c499472ece3590746b4761e Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 21 Mar 2017 20:59:35 +0300 Subject: [PATCH] Fix WebPage reply preview. Sometimes HistoryWebPage::hasReplyPreview() was returning true while the HistoryWebPage::replyPreview() method was not offering anything. --- Telegram/SourceFiles/history/history_media_types.cpp | 4 ++++ Telegram/SourceFiles/history/history_media_types.h | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index 91340c60b0..248962730a 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -3010,6 +3010,10 @@ TextWithEntities HistoryWebPage::selectedText(TextSelection selection) const { return titleResult; } +bool HistoryWebPage::hasReplyPreview() const { + return _attach ? _attach->hasReplyPreview() : (_data->photo ? true : false); +} + ImagePtr HistoryWebPage::replyPreview() { return _attach ? _attach->replyPreview() : (_data->photo ? _data->photo->makeReplyPreview() : ImagePtr()); } diff --git a/Telegram/SourceFiles/history/history_media_types.h b/Telegram/SourceFiles/history/history_media_types.h index c8f16e82b2..61b2b9e3c7 100644 --- a/Telegram/SourceFiles/history/history_media_types.h +++ b/Telegram/SourceFiles/history/history_media_types.h @@ -726,9 +726,7 @@ public: void attachToParent() override; void detachFromParent() override; - bool hasReplyPreview() const override { - return (_data->photo && !_data->photo->thumb->isNull()) || (_data->document && !_data->document->thumb->isNull()); - } + bool hasReplyPreview() const override; ImagePtr replyPreview() override; WebPageData *webpage() {