Fix fast reply from message corner in Replies section.

This commit is contained in:
John Preston 2020-09-30 21:04:08 +03:00
parent e8a58c4c8d
commit 745bbfe268
4 changed files with 16 additions and 2 deletions

View file

@ -1427,6 +1427,14 @@ bool RepliesWidget::showMessage(
return true;
}
bool RepliesWidget::replyToMessage(not_null<HistoryItem*> item) {
if (item->history() != _history || item->replyToTop() != _rootId) {
return false;
}
_composeControls->replyToMessage(item->fullId());
return true;
}
void RepliesWidget::saveState(not_null<RepliesMemento*> memento) {
memento->setReplies(_replies);
memento->setReplyReturns(_replyReturns);

View file

@ -88,6 +88,7 @@ public:
PeerId peerId,
const Window::SectionShow &params,
MsgId messageId) override;
bool replyToMessage(not_null<HistoryItem*> item) override;
void setInternalState(
const QRect &geometry,

View file

@ -534,8 +534,9 @@ bool MainWidget::shareUrl(
}
void MainWidget::replyToItem(not_null<HistoryItem*> 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);
}
}

View file

@ -125,6 +125,10 @@ public:
return false;
}
virtual bool replyToMessage(not_null<HistoryItem*> 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<SectionMemento> createMemento();