Added general replies to admin log messages.

This commit is contained in:
23rd
2026-01-08 07:12:48 +03:00
parent 4f96812b90
commit e8566002d6
4 changed files with 8 additions and 10 deletions
@@ -722,14 +722,7 @@ bool InnerWidget::elementAnimationsPaused() {
}
bool InnerWidget::elementHideReply(not_null<const Element*> view) {
if (const auto item = view->data()) {
if (const auto quote = item->Get<HistoryMessageReply>()) {
if (quote->manualQuote()) {
return false;
}
}
}
return true;
return false;
}
bool InnerWidget::elementShownUnread(not_null<const Element*> view) {
@@ -87,7 +87,7 @@ std::optional<MTPMessageReplyHeader> PrepareLogReply(
}
return header->match([&](const MTPDmessageReplyHeader &data)
-> std::optional<MTPMessageReplyHeader> {
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(
@@ -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()) {
@@ -424,6 +424,7 @@ void Reply::setLinkFrom(
not_null<HistoryMessageReply*> 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<LambdaClickHandler>(externalLink)
: message
? JumpToMessageClickHandler(message, returnToId, highlight)
: story
? JumpToStoryClickHandler(story)