diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 3c8e9d632..98aeda2a2 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -2607,6 +2607,10 @@ HistoryItem *History::lastSentMessage() const { for (const auto &block : ranges::view::reverse(blocks)) { for (const auto &message : ranges::view::reverse(block->messages)) { const auto item = message->data(); + // Skip if message is editing media. + if (item->isEditingMedia()) { + continue; + } // Skip if message is video message or sticker. if (const auto media = item->media()) { // Skip only if media is not webpage. diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index be9ffb004..227a9b84b 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -619,7 +619,8 @@ bool HistoryMessage::allowsEdit(TimeId now) const { return canStopPoll() && !isTooOldForEdit(now) && (!_media || _media->allowsEdit()) - && !isUnsupportedMessage(); + && !isUnsupportedMessage() + && !_isEditingMedia; } bool HistoryMessage::uploading() const { @@ -768,6 +769,7 @@ void HistoryMessage::returnSavedMedia() { } else { history()->owner().requestItemViewRefresh(this); } + _isEditingMedia = false; } void HistoryMessage::setMedia(const MTPMessageMedia &media) { @@ -1166,6 +1168,7 @@ std::unique_ptr HistoryMessage::createView( HistoryMessage::~HistoryMessage() { _media.reset(); + _savedMedia.reset(); if (auto reply = Get()) { reply->clearData(this); }