2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

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

@@ -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) {