diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 29638d49e..eb34388d8 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2396,6 +2396,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_credits_box_history_entry_media" = "Media"; "lng_credits_box_history_entry_about" = "You can dispute this transaction {link}."; "lng_credits_box_history_entry_about_link" = "here"; +"lng_credits_box_history_entry_reaction_name" = "Star Reaction"; "lng_credits_small_balance_title#one" = "{count} Star Needed"; "lng_credits_small_balance_title#other" = "{count} Stars Needed"; "lng_credits_small_balance_about" = "Buy **Stars** and use them on **{bot}** and other miniapps."; diff --git a/Telegram/SourceFiles/api/api_credits.cpp b/Telegram/SourceFiles/api/api_credits.cpp index 4458a5446..5cb869fba 100644 --- a/Telegram/SourceFiles/api/api_credits.cpp +++ b/Telegram/SourceFiles/api/api_credits.cpp @@ -94,13 +94,14 @@ constexpr auto kTransactionsLimit = 100; }, [](const MTPDstarsTransactionPeerAds &) { return Data::CreditsHistoryEntry::PeerType::Ads; }), - .refunded = tl.data().is_refund(), - .pending = tl.data().is_pending(), - .failed = tl.data().is_failed(), .successDate = tl.data().vtransaction_date() ? base::unixtime::parse(tl.data().vtransaction_date()->v) : QDateTime(), .successLink = qs(tl.data().vtransaction_url().value_or_empty()), + .reaction = tl.data().is_reaction(), + .refunded = tl.data().is_refund(), + .pending = tl.data().is_pending(), + .failed = tl.data().is_failed(), .in = (int64(tl.data().vstars().v) >= 0), .gift = tl.data().is_gift(), }; diff --git a/Telegram/SourceFiles/data/data_credits.h b/Telegram/SourceFiles/data/data_credits.h index ee8d948a7..bff8c93b5 100644 --- a/Telegram/SourceFiles/data/data_credits.h +++ b/Telegram/SourceFiles/data/data_credits.h @@ -52,11 +52,12 @@ struct CreditsHistoryEntry final { uint64 bareMsgId = 0; uint64 barePeerId = 0; PeerType peerType; + QDateTime successDate; + QString successLink; + bool reaction = false; bool refunded = false; bool pending = false; bool failed = false; - QDateTime successDate; - QString successLink; bool in = false; bool gift = false; }; diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp index 86640fe5b..4db813865 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp @@ -753,6 +753,7 @@ private: const int _rowHeight; PaintRoundImageCallback _paintUserpicCallback; + QString _title; QString _name; Ui::Text::String _rightText; @@ -787,9 +788,14 @@ CreditsRow::CreditsRow(const Descriptor &descriptor) } void CreditsRow::init() { - _name = !PeerListRow::special() + const auto name = !PeerListRow::special() ? PeerListRow::generateName() : Ui::GenerateEntryName(_entry).text; + _name = _entry.reaction + ? Ui::GenerateEntryName(_entry).text + : _entry.title.isEmpty() + ? name + : _entry.title; const auto joiner = QString(QChar(' ')) + QChar(8212) + QChar(' '); PeerListRow::setCustomStatus( langDateTimeFull(_entry.date) @@ -802,7 +808,7 @@ void CreditsRow::init() { : QString()) + ((_entry.gift && PeerListRow::special()) ? (joiner + tr::lng_credits_box_history_entry_anonymous(tr::now)) - : (_entry.title.isEmpty() ? QString() : (joiner + _name)))); + : ((_name == name) ? QString() : (joiner + name)))); { constexpr auto kMinus = QChar(0x2212); _rightText.setText( diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index 57c24f88a..88d5bb89c 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -554,7 +554,7 @@ void ReceiptCreditsBox( ? e.title : e.gift ? tr::lng_credits_box_history_entry_gift_name(tr::now) - : peer + : (peer && !e.reaction) ? peer->name() : Ui::GenerateEntryName(e).text), st::creditsBoxAboutTitle))); diff --git a/Telegram/SourceFiles/ui/effects/credits_graphics.cpp b/Telegram/SourceFiles/ui/effects/credits_graphics.cpp index 018188cb3..7deb7e44f 100644 --- a/Telegram/SourceFiles/ui/effects/credits_graphics.cpp +++ b/Telegram/SourceFiles/ui/effects/credits_graphics.cpp @@ -455,7 +455,9 @@ Fn)> PaintPreviewCallback( } TextWithEntities GenerateEntryName(const Data::CreditsHistoryEntry &entry) { - return (entry.gift + return (entry.reaction + ? tr::lng_credits_box_history_entry_reaction_name + : entry.gift ? tr::lng_credits_box_history_entry_gift_name : (entry.peerType == Data::CreditsHistoryEntry::PeerType::Fragment) ? tr::lng_credits_box_history_entry_fragment