mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Show forward original sender in reply bar.
This commit is contained in:
@@ -408,7 +408,10 @@ void Reply::updateName(
|
||||
std::optional<PeerData*> resolvedSender) const {
|
||||
auto viaBotUsername = QString();
|
||||
const auto message = data->resolvedMessage.get();
|
||||
if (message && !message->Has<HistoryMessageForwarded>()) {
|
||||
const auto forwarded = message
|
||||
? message->Get<HistoryMessageForwarded>()
|
||||
: nullptr;
|
||||
if (message && !forwarded) {
|
||||
if (const auto bot = message->viaBot()) {
|
||||
viaBotUsername = bot->username();
|
||||
}
|
||||
@@ -424,7 +427,14 @@ void Reply::updateName(
|
||||
&& externalPeer
|
||||
&& (externalPeer != sender)
|
||||
&& (externalPeer->isChat() || externalPeer->isMegagroup());
|
||||
const auto shorten = !viaBotUsername.isEmpty() || groupNameAdded;
|
||||
const auto originalNameAdded = !displayAsExternal
|
||||
&& forwarded
|
||||
&& !message->isDiscussionPost()
|
||||
&& (!message->showForwardsFromSender(forwarded)
|
||||
|| forwarded->forwardOfForward());
|
||||
const auto shorten = !viaBotUsername.isEmpty()
|
||||
|| groupNameAdded
|
||||
|| originalNameAdded;
|
||||
const auto name = sender
|
||||
? senderName(sender, shorten)
|
||||
: senderName(view, data, shorten);
|
||||
@@ -443,6 +453,11 @@ void Reply::updateName(
|
||||
if (groupNameAdded) {
|
||||
nameFull.append(' ').append(PeerEmoji(history, externalPeer));
|
||||
nameFull.append(externalPeer->name());
|
||||
} else if (originalNameAdded) {
|
||||
nameFull.append(' ').append(ForwardEmoji(&history->owner()));
|
||||
nameFull.append(forwarded->originalSender
|
||||
? forwarded->originalSender->name()
|
||||
: forwarded->originalHiddenSenderInfo->name);
|
||||
}
|
||||
if (!viaBotUsername.isEmpty()) {
|
||||
nameFull.append(u" @"_q).append(viaBotUsername);
|
||||
@@ -838,6 +853,13 @@ TextWithEntities Reply::PeerEmoji(
|
||||
icon.second));
|
||||
}
|
||||
|
||||
TextWithEntities Reply::ForwardEmoji(not_null<Data::Session*> owner) {
|
||||
return Ui::Text::SingleCustomEmoji(
|
||||
owner->customEmojiManager().registerInternalEmoji(
|
||||
st::historyReplyForward,
|
||||
st::historyReplyForwardPadding));
|
||||
}
|
||||
|
||||
TextWithEntities Reply::ComposePreviewName(
|
||||
not_null<History*> history,
|
||||
not_null<HistoryItem*> to,
|
||||
|
@@ -105,6 +105,8 @@ public:
|
||||
[[nodiscard]] static TextWithEntities PeerEmoji(
|
||||
not_null<Data::Session*> owner,
|
||||
PeerData *peer);
|
||||
[[nodiscard]] static TextWithEntities ForwardEmoji(
|
||||
not_null<Data::Session*> owner);
|
||||
[[nodiscard]] static TextWithEntities ComposePreviewName(
|
||||
not_null<History*> history,
|
||||
not_null<HistoryItem*> to,
|
||||
|
Reference in New Issue
Block a user