Improve "... boosted group" phrases.

This commit is contained in:
John Preston 2025-01-09 22:19:34 +04:00
parent afffdd5bbf
commit 97c259d928
2 changed files with 20 additions and 7 deletions

View file

@ -2094,6 +2094,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_giveaway_results_credits#other" = "{count} winners of the giveaway were randomly selected by Telegram and received their prize.";
"lng_action_giveaway_results_credits_some" = "Some winners of the giveaway were randomly selected by Telegram and received their prize.";
"lng_action_giveaway_results_none" = "No winners of the giveaway could be selected.";
"lng_action_boost_apply_me" = "You boosted the group";
"lng_action_boost_apply#one" = "{from} boosted the group";
"lng_action_boost_apply#other" = "{from} boosted the group {count} times";
"lng_action_set_chat_intro" = "{from} added the message below for all empty chats. How?";

View file

@ -5318,14 +5318,26 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
auto prepareBoostApply = [&](const MTPDmessageActionBoostApply &action) {
auto result = PreparedServiceText();
const auto boosts = action.vboosts().v;
const auto isSelf = (_from->id == _from->session().userPeerId());
result.links.push_back(fromLink());
result.text = tr::lng_action_boost_apply(
tr::now,
lt_count,
boosts,
lt_from,
fromLinkText(), // Link 1.
Ui::Text::WithEntities);
result.text = isSelf
? tr::lng_action_boost_apply_me(tr::now, Ui::Text::WithEntities)
: tr::lng_action_boost_apply(
tr::now,
lt_count,
boosts,
lt_from,
fromLinkText(), // Link 1.
Ui::Text::WithEntities);
const auto channel = _history->peer->asChannel();
setCustomServiceLink(std::make_shared<LambdaClickHandler>([=](
ClickContext context) {
const auto my = context.other.value<ClickHandlerContext>();
const auto weak = my.sessionWindow;
if (const auto strong = channel ? weak.get() : nullptr) {
strong->resolveBoostState(channel);
}
}));
return result;
};
auto preparePaymentRefunded = [&](const MTPDmessageActionPaymentRefunded &action) {