mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show forward original sender in reply bar.
This commit is contained in:
parent
ca9caa36da
commit
5c29cc59c8
3 changed files with 28 additions and 2 deletions
|
@ -408,7 +408,10 @@ void Reply::updateName(
|
||||||
std::optional<PeerData*> resolvedSender) const {
|
std::optional<PeerData*> resolvedSender) const {
|
||||||
auto viaBotUsername = QString();
|
auto viaBotUsername = QString();
|
||||||
const auto message = data->resolvedMessage.get();
|
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()) {
|
if (const auto bot = message->viaBot()) {
|
||||||
viaBotUsername = bot->username();
|
viaBotUsername = bot->username();
|
||||||
}
|
}
|
||||||
|
@ -424,7 +427,14 @@ void Reply::updateName(
|
||||||
&& externalPeer
|
&& externalPeer
|
||||||
&& (externalPeer != sender)
|
&& (externalPeer != sender)
|
||||||
&& (externalPeer->isChat() || externalPeer->isMegagroup());
|
&& (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
|
const auto name = sender
|
||||||
? senderName(sender, shorten)
|
? senderName(sender, shorten)
|
||||||
: senderName(view, data, shorten);
|
: senderName(view, data, shorten);
|
||||||
|
@ -443,6 +453,11 @@ void Reply::updateName(
|
||||||
if (groupNameAdded) {
|
if (groupNameAdded) {
|
||||||
nameFull.append(' ').append(PeerEmoji(history, externalPeer));
|
nameFull.append(' ').append(PeerEmoji(history, externalPeer));
|
||||||
nameFull.append(externalPeer->name());
|
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()) {
|
if (!viaBotUsername.isEmpty()) {
|
||||||
nameFull.append(u" @"_q).append(viaBotUsername);
|
nameFull.append(u" @"_q).append(viaBotUsername);
|
||||||
|
@ -838,6 +853,13 @@ TextWithEntities Reply::PeerEmoji(
|
||||||
icon.second));
|
icon.second));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextWithEntities Reply::ForwardEmoji(not_null<Data::Session*> owner) {
|
||||||
|
return Ui::Text::SingleCustomEmoji(
|
||||||
|
owner->customEmojiManager().registerInternalEmoji(
|
||||||
|
st::historyReplyForward,
|
||||||
|
st::historyReplyForwardPadding));
|
||||||
|
}
|
||||||
|
|
||||||
TextWithEntities Reply::ComposePreviewName(
|
TextWithEntities Reply::ComposePreviewName(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
not_null<HistoryItem*> to,
|
not_null<HistoryItem*> to,
|
||||||
|
|
|
@ -105,6 +105,8 @@ public:
|
||||||
[[nodiscard]] static TextWithEntities PeerEmoji(
|
[[nodiscard]] static TextWithEntities PeerEmoji(
|
||||||
not_null<Data::Session*> owner,
|
not_null<Data::Session*> owner,
|
||||||
PeerData *peer);
|
PeerData *peer);
|
||||||
|
[[nodiscard]] static TextWithEntities ForwardEmoji(
|
||||||
|
not_null<Data::Session*> owner);
|
||||||
[[nodiscard]] static TextWithEntities ComposePreviewName(
|
[[nodiscard]] static TextWithEntities ComposePreviewName(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
not_null<HistoryItem*> to,
|
not_null<HistoryItem*> to,
|
||||||
|
|
|
@ -38,6 +38,8 @@ historyReplyGroup: icon {{ "chat/reply_type_group", windowFg }};
|
||||||
historyReplyGroupPadding: margins(0px, 4px, 4px, 0px);
|
historyReplyGroupPadding: margins(0px, 4px, 4px, 0px);
|
||||||
historyReplyChannel: icon {{ "chat/reply_type_channel", windowFg }};
|
historyReplyChannel: icon {{ "chat/reply_type_channel", windowFg }};
|
||||||
historyReplyChannelPadding: margins(0px, 5px, 4px, 0px);
|
historyReplyChannelPadding: margins(0px, 5px, 4px, 0px);
|
||||||
|
historyReplyForward: icon {{ "mini_forward", windowFg }};
|
||||||
|
historyReplyForwardPadding: margins(0px, 2px, 2px, 0px);
|
||||||
|
|
||||||
msgReplyPadding: margins(6px, 6px, 11px, 6px);
|
msgReplyPadding: margins(6px, 6px, 11px, 6px);
|
||||||
msgReplyBarPos: point(1px, 0px);
|
msgReplyBarPos: point(1px, 0px);
|
||||||
|
|
Loading…
Add table
Reference in a new issue