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