diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index c2571a98a8..00977a96ca 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -1427,6 +1427,14 @@ bool RepliesWidget::showMessage( return true; } +bool RepliesWidget::replyToMessage(not_null item) { + if (item->history() != _history || item->replyToTop() != _rootId) { + return false; + } + _composeControls->replyToMessage(item->fullId()); + return true; +} + void RepliesWidget::saveState(not_null memento) { memento->setReplies(_replies); memento->setReplyReturns(_replyReturns); diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.h b/Telegram/SourceFiles/history/view/history_view_replies_section.h index 88d6d2aab0..e58c9e8cdf 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.h +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.h @@ -88,6 +88,7 @@ public: PeerId peerId, const Window::SectionShow ¶ms, MsgId messageId) override; + bool replyToMessage(not_null item) override; void setInternalState( const QRect &geometry, diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 87bb87e8d9..34257e3dda 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -534,8 +534,9 @@ bool MainWidget::shareUrl( } void MainWidget::replyToItem(not_null item) { - if (_history->peer() == item->history()->peer - || _history->peer() == item->history()->peer->migrateTo()) { + if ((!_mainSection || !_mainSection->replyToMessage(item)) + && (_history->peer() == item->history()->peer + || _history->peer() == item->history()->peer->migrateTo())) { _history->replyToMessage(item); } } diff --git a/Telegram/SourceFiles/window/section_widget.h b/Telegram/SourceFiles/window/section_widget.h index 68a0790365..6d5f3b7fdc 100644 --- a/Telegram/SourceFiles/window/section_widget.h +++ b/Telegram/SourceFiles/window/section_widget.h @@ -125,6 +125,10 @@ public: return false; } + virtual bool replyToMessage(not_null item) { + return false; + } + // Create a memento of that section to store it in the history stack. // This method may modify the section ("take" heavy items). virtual std::unique_ptr createMemento();