diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 3d1fecb026..7bf546470a 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1898,6 +1898,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_action_giveaway_results#one" = "{count} winner of the giveaway was randomly selected by Telegram and received private messages with giftcodes."; "lng_action_giveaway_results#other" = "{count} winners of the giveaway were randomly selected by Telegram and received private messages with giftcodes."; "lng_action_giveaway_results_some" = "Some winners of the giveaway were randomly selected by Telegram and received private messages with giftcodes."; +"lng_action_giveaway_results_credits#one" = "{count} winner of the giveaway was randomly selected by Telegram and received their prize."; +"lng_action_giveaway_results_credits#other" = "{count} winner of the giveaway was 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#one" = "{from} boosted the group"; "lng_action_boost_apply#other" = "{from} boosted the group {count} times"; diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp index 4ef1ae7ea0..ef7f25e518 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.cpp +++ b/Telegram/SourceFiles/export/data/export_data_types.cpp @@ -1543,6 +1543,7 @@ ServiceAction ParseServiceAction( auto content = ActionGiveawayResults(); content.winners = data.vwinners_count().v; content.unclaimed = data.vunclaimed_count().v; + content.credits = data.is_stars(); result.content = content; }, [&](const MTPDmessageActionBoostApply &data) { auto content = ActionBoostApply(); diff --git a/Telegram/SourceFiles/export/data/export_data_types.h b/Telegram/SourceFiles/export/data/export_data_types.h index a708f01b48..7adf63d8c2 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.h +++ b/Telegram/SourceFiles/export/data/export_data_types.h @@ -590,6 +590,7 @@ struct ActionGiveawayLaunch { struct ActionGiveawayResults { int winners = 0; int unclaimed = 0; + bool credits = false; }; struct ActionBoostApply { diff --git a/Telegram/SourceFiles/export/output/export_output_html.cpp b/Telegram/SourceFiles/export/output/export_output_html.cpp index 05b6dc2de6..00a755bd93 100644 --- a/Telegram/SourceFiles/export/output/export_output_html.cpp +++ b/Telegram/SourceFiles/export/output/export_output_html.cpp @@ -1313,11 +1313,20 @@ auto HtmlWriter::Wrap::pushMessage( return serviceFrom + " just started a giveaway " "of Telegram Premium subscriptions to its followers."; }, [&](const ActionGiveawayResults &data) { - return (data.winners > 0) - ? NumberToString(data.winners) - + " of the giveaway were randomly selected by Telegram " - "and received private messages with giftcodes." - : "No winners of the giveaway could be selected."; + return !data.winners + ? "No winners of the giveaway could be selected." + : (data.credits && data.unclaimed) + ? "Some winners of the giveaway were randomly selected by " + "Telegram and received their prize." + : (!data.credits && data.unclaimed) + ? "Some winners of the giveaway were randomly selected by " + "Telegram and received private messages with giftcodes." + : (data.credits && !data.unclaimed) + ? NumberToString(data.winners) + " of the giveaway was randomly " + "selected by Telegram and received their prize." + : NumberToString(data.winners) + " of the giveaway was randomly " + "selected by Telegram and received private messages with " + "giftcodes."; }, [&](const ActionBoostApply &data) { return serviceFrom + " boosted the group " diff --git a/Telegram/SourceFiles/export/output/export_output_json.cpp b/Telegram/SourceFiles/export/output/export_output_json.cpp index 964193a7b9..c7378f392d 100644 --- a/Telegram/SourceFiles/export/output/export_output_json.cpp +++ b/Telegram/SourceFiles/export/output/export_output_json.cpp @@ -615,6 +615,7 @@ QByteArray SerializeMessage( pushAction("giveaway_results"); push("winners", data.winners); push("unclaimed", data.unclaimed); + push("stars", data.credits); }, [&](const ActionSetChatWallPaper &data) { pushActor(); pushAction(data.same diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index edc2da6349..ea92626c44 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -5180,15 +5180,20 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { auto result = PreparedServiceText(); const auto winners = action.vwinners_count().v; const auto unclaimed = action.vunclaimed_count().v; + const auto credits = action.is_stars(); result.text = { (!winners ? tr::lng_action_giveaway_results_none(tr::now) - : unclaimed + : (credits && unclaimed) + ? tr::lng_action_giveaway_results_credits_some(tr::now) + : (!credits && unclaimed) ? tr::lng_action_giveaway_results_some(tr::now) - : tr::lng_action_giveaway_results( + : (credits && !unclaimed) + ? tr::lng_action_giveaway_results_credits( tr::now, lt_count, - winners)) + winners) + : tr::lng_action_giveaway_results(tr::now, lt_count, winners)) }; return result; };