diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 09b48813b..7bd419431 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -473,7 +473,7 @@ Data::MessagePosition HistoryItem::position() const { } MsgId HistoryItem::replyToId() const { - if (auto reply = Get()) { + if (const auto reply = Get()) { return reply->replyToId(); } return 0; diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index 1539dd24e..4efc01160 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -154,7 +154,7 @@ bool HistoryMessageReply::updateData( updateName(); - replyToLnk = goToMessageClickHandler(replyToMsg, holder->fullId()); + setReplyToLinkFrom(holder); if (!replyToMsg->Has()) { if (auto bot = replyToMsg->viaBot()) { replyToVia = std::make_unique(); @@ -170,6 +170,13 @@ bool HistoryMessageReply::updateData( return (replyToMsg || !replyToMsgId); } +void HistoryMessageReply::setReplyToLinkFrom( + not_null holder) { + replyToLnk = replyToMsg + ? goToMessageClickHandler(replyToMsg, holder->fullId()) + : nullptr; +} + void HistoryMessageReply::clearData(not_null holder) { replyToVia = nullptr; if (replyToMsg) { diff --git a/Telegram/SourceFiles/history/history_item_components.h b/Telegram/SourceFiles/history/history_item_components.h index 5efa9d291..42ae62e7c 100644 --- a/Telegram/SourceFiles/history/history_item_components.h +++ b/Telegram/SourceFiles/history/history_item_components.h @@ -117,6 +117,8 @@ struct HistoryMessageReply : public RuntimeComponent holder); MsgId replyToMsgId = 0; HistoryItem *replyToMsg = nullptr; diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 0354ed9ca..e103a424c 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -1082,6 +1082,11 @@ void HistoryMessage::setRealId(MsgId newId) { HistoryItem::setRealId(newId); Auth().data().groups().refreshMessage(this); Auth().data().requestItemResize(this); + if (const auto reply = Get()) { + if (reply->replyToLink()) { + reply->setReplyToLinkFrom(this); + } + } } void HistoryMessage::dependencyItemRemoved(HistoryItem *dependency) {