mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Keep external replies in forwards.
This commit is contained in:
parent
d831775e2f
commit
b4c7272351
4 changed files with 21 additions and 7 deletions
|
@ -2685,6 +2685,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_reply_options_quote" = "Update Quote";
|
||||
"lng_reply_header_short" = "Reply";
|
||||
"lng_reply_quote_selected" = "Quote Selected";
|
||||
"lng_reply_from_private_chat" = "This reply is from a private chat.";
|
||||
"lng_link_options_header" = "Link Preview Settings";
|
||||
"lng_link_header_short" = "Link";
|
||||
"lng_link_move_up" = "Move Up";
|
||||
|
|
|
@ -449,6 +449,14 @@ HistoryItem::HistoryItem(
|
|||
const auto dropForwardInfo = original->computeDropForwardedInfo();
|
||||
config.reply.messageId = config.reply.topMessageId = topicRootId;
|
||||
config.reply.topicPost = (topicRootId != 0);
|
||||
if (const auto originalReply = original->Get<HistoryMessageReply>()) {
|
||||
if (originalReply->external()) {
|
||||
config.reply = originalReply->fields();
|
||||
if (!config.reply.externalPeerId) {
|
||||
config.reply.messageId = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!dropForwardInfo) {
|
||||
config.originalDate = original->originalDate();
|
||||
if (const auto info = original->hiddenSenderInfo()) {
|
||||
|
|
|
@ -397,9 +397,6 @@ ReplyFields ReplyFieldsFromMTP(
|
|||
auto result = ReplyFields();
|
||||
if (const auto peer = data.vreply_to_peer_id()) {
|
||||
result.externalPeerId = peerFromMTP(*peer);
|
||||
if (result.externalPeerId == history->peer->id) {
|
||||
result.externalPeerId = 0;
|
||||
}
|
||||
}
|
||||
const auto owner = &history->owner();
|
||||
if (const auto id = data.vreply_to_msg_id().value_or_empty()) {
|
||||
|
@ -526,8 +523,7 @@ bool HistoryMessageReply::updateData(
|
|||
}
|
||||
}
|
||||
|
||||
const auto external = _fields.externalSenderId
|
||||
|| !_fields.externalSenderName.isEmpty();
|
||||
const auto external = this->external();
|
||||
if (resolvedMessage
|
||||
|| resolvedStory
|
||||
|| (external && (!_fields.messageId || force))) {
|
||||
|
@ -625,9 +621,8 @@ void HistoryMessageReply::setLinkFrom(
|
|||
if (externalPeerId) {
|
||||
controller->showPeerInfo(
|
||||
controller->session().data().peer(externalPeerId));
|
||||
} else {
|
||||
controller->showToast(u"External reply"_q);
|
||||
}
|
||||
controller->showToast(tr::lng_reply_from_private_chat(tr::now));
|
||||
}
|
||||
};
|
||||
_link = resolvedMessage
|
||||
|
@ -666,6 +661,12 @@ void HistoryMessageReply::clearData(not_null<HistoryItem*> holder) {
|
|||
refreshReplyToMedia();
|
||||
}
|
||||
|
||||
bool HistoryMessageReply::external() const {
|
||||
return _fields.externalPeerId
|
||||
|| _fields.externalSenderId
|
||||
|| !_fields.externalSenderName.isEmpty();
|
||||
}
|
||||
|
||||
PeerData *HistoryMessageReply::sender(not_null<HistoryItem*> holder) const {
|
||||
if (resolvedStory) {
|
||||
return resolvedStory->peer();
|
||||
|
|
|
@ -274,6 +274,7 @@ struct HistoryMessageReply
|
|||
// Must be called before destructor.
|
||||
void clearData(not_null<HistoryItem*> holder);
|
||||
|
||||
[[nodiscard]] bool external() const;
|
||||
[[nodiscard]] PeerData *sender(not_null<HistoryItem*> holder) const;
|
||||
[[nodiscard]] QString senderName(not_null<HistoryItem*> holder) const;
|
||||
[[nodiscard]] QString senderName(not_null<PeerData*> peer) const;
|
||||
|
@ -301,6 +302,9 @@ struct HistoryMessageReply
|
|||
bool inBubble) const;
|
||||
void unloadPersistentAnimation();
|
||||
|
||||
[[nodiscard]] ReplyFields fields() const {
|
||||
return _fields;
|
||||
}
|
||||
[[nodiscard]] PeerId externalPeerId() const {
|
||||
return _fields.externalPeerId;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue