From e8566002d69656364e8e2a159183d6b56b9349e2 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 8 Jan 2026 07:12:48 +0300 Subject: [PATCH] Added general replies to admin log messages. --- .../history/admin_log/history_admin_log_inner.cpp | 9 +-------- .../history/admin_log/history_admin_log_item.cpp | 2 +- Telegram/SourceFiles/history/history_item_components.cpp | 2 ++ Telegram/SourceFiles/history/view/history_view_reply.cpp | 5 ++++- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index 1fc8be4082..e2fea82f4e 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -722,14 +722,7 @@ bool InnerWidget::elementAnimationsPaused() { } bool InnerWidget::elementHideReply(not_null view) { - if (const auto item = view->data()) { - if (const auto quote = item->Get()) { - if (quote->manualQuote()) { - return false; - } - } - } - return true; + return false; } bool InnerWidget::elementShownUnread(not_null view) { diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index 3273370e7b..e8b30c43ae 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -87,7 +87,7 @@ std::optional PrepareLogReply( } return header->match([&](const MTPDmessageReplyHeader &data) -> std::optional { - if (data.vreply_to_peer_id()) { + if (data.vreply_to_peer_id() || data.vreply_to_msg_id()) { return *header; } else if (data.is_forum_topic()) { const auto topId = data.vreply_to_top_id().value_or( diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index db9e31ebf3..a94a72a611 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -374,6 +374,8 @@ ReplyFields ReplyFieldsFromMTP( auto result = ReplyFields(); if (const auto peer = data.vreply_to_peer_id()) { result.externalPeerId = peerFromMTP(*peer); + } else if (item->isAdminLogEntry()) { + result.externalPeerId = item->history()->peer->id; } const auto owner = &item->history()->owner(); if (const auto id = data.vreply_to_msg_id().value_or_empty()) { diff --git a/Telegram/SourceFiles/history/view/history_view_reply.cpp b/Telegram/SourceFiles/history/view/history_view_reply.cpp index a1e32a0b1b..bc9c84e0ef 100644 --- a/Telegram/SourceFiles/history/view/history_view_reply.cpp +++ b/Telegram/SourceFiles/history/view/history_view_reply.cpp @@ -424,6 +424,7 @@ void Reply::setLinkFrom( not_null data) { const auto weak = base::make_weak(view); const auto &fields = data->fields(); + const auto isAdminLogEntry = view->data()->isAdminLogEntry(); const auto externalChannelId = peerToChannel(fields.externalPeerId); const auto messageId = fields.messageId; const auto highlight = MessageHighlightId{ @@ -473,7 +474,9 @@ void Reply::setLinkFrom( }; const auto message = data->resolvedMessage.get(); const auto story = data->resolvedStory.get(); - _link = message + _link = isAdminLogEntry + ? std::make_shared(externalLink) + : message ? JumpToMessageClickHandler(message, returnToId, highlight) : story ? JumpToStoryClickHandler(story)