Specify auction phrases for sent auction gifts.

This commit is contained in:
John Preston
2025-11-11 11:16:59 +04:00
parent 58d2e2ece2
commit 1f8214e658
2 changed files with 30 additions and 11 deletions
+2
View File
@@ -2288,6 +2288,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_gift_sent_channel" = "{user} sent a gift to {name} for {cost}";
"lng_action_gift_sent_self_channel" = "You sent a gift to {name} for {cost}";
"lng_action_gift_self_bought" = "You bought a gift for {cost}";
"lng_action_gift_self_auction" = "You've successfully bought a gift in the auction for {cost}.";
"lng_action_gift_auction" = "You've successfully bought a gift for {name} in the auction for {cost}.";
"lng_action_gift_self_subtitle" = "Saved Gift";
"lng_action_gift_self_about#one" = "Display this gift on your page or convert it to **{count}** Star.";
"lng_action_gift_self_about#other" = "Display this gift on your page or convert it to **{count}** Stars.";
+28 -11
View File
@@ -6032,12 +6032,12 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
Ui::Text::WithEntities);
} else {
result.text = tr::lng_action_gift_sent_self_channel(
tr::now,
lt_name,
Ui::Text::Link(channel->name(), 1),
lt_cost,
cost,
Ui::Text::WithEntities);
tr::now,
lt_name,
Ui::Text::Link(channel->name(), 1),
lt_cost,
cost,
Ui::Text::WithEntities);
}
} else {
result.links.push_back(from->createOpenLink());
@@ -6065,13 +6065,29 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
}
}
} else if (anonymous || _history->peer->isSelf()) {
result.text = (anonymous
? tr::lng_action_gift_received_anonymous
: tr::lng_action_gift_self_bought)(
const auto to = (action.is_auction_acquired() && action.vto_id())
? peer->owner().peer(peerFromMTP(*action.vto_id())).get()
: nullptr;
result.text = to
? tr::lng_action_gift_auction(
tr::now,
lt_name,
Ui::Text::Link(to->shortName(), 1),
lt_cost,
cost,
Ui::Text::WithEntities);
Ui::Text::WithEntities)
: (action.is_auction_acquired()
? tr::lng_action_gift_self_auction
: anonymous
? tr::lng_action_gift_received_anonymous
: tr::lng_action_gift_self_bought)(
tr::now,
lt_cost,
cost,
Ui::Text::WithEntities);
if (to) {
result.links.push_back(to->createOpenLink());
}
} else if (upgradeGifted) {
// Who sent the gift.
const auto fromId = action.vfrom_id()
@@ -6128,7 +6144,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
result.links.push_back(peer->createOpenLink());
}
result.text = isSelf
? tr::lng_action_gift_sent(tr::now,
? tr::lng_action_gift_sent(
tr::now,
lt_cost,
cost,
Ui::Text::WithEntities)