diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index f4a00467a..043922347 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2043,6 +2043,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_action_gift_premium_months#one" = "{count} Month Premium"; "lng_action_gift_premium_months#other" = "{count} Months Premium"; "lng_action_gift_premium_about" = "Subscription for exclusive Telegram features."; +"lng_action_gift_refunded" = "This gift was downgraded because a request to refund the payment related to this gift was made, and the money was returned."; "lng_action_suggested_photo_me" = "You suggested this photo for {user}'s Telegram profile."; "lng_action_suggested_photo" = "{user} suggests this photo for your Telegram profile."; "lng_action_suggested_photo_button" = "View Photo"; diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index e06508133..3abe3b32e 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -1363,7 +1363,7 @@ void AddStarGiftTable( std::move(toggleVisibility)), marginWithButton); } - if (entry.limitedCount > 0) { + if (entry.limitedCount > 0 && !entry.giftRefunded) { auto amount = rpl::single(TextWithEntities{ Lang::FormatCountDecimal(entry.limitedCount) }); diff --git a/Telegram/SourceFiles/data/data_credits.h b/Telegram/SourceFiles/data/data_credits.h index 567eb9478..85ed5041e 100644 --- a/Telegram/SourceFiles/data/data_credits.h +++ b/Telegram/SourceFiles/data/data_credits.h @@ -85,6 +85,7 @@ struct CreditsHistoryEntry final { bool anonymous : 1 = false; bool stargift : 1 = false; bool giftTransferred : 1 = false; + bool giftRefunded : 1 = false; bool savedToProfile : 1 = false; bool fromGiftsList : 1 = false; bool soldOutInfo : 1 = false; diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index c8f57334f..1f8e8bcc7 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -5408,7 +5408,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { const auto stars = action.vgift().match([&]( const MTPDstarGift &data) { return uint64(data.vstars().v) - + uint64(data.vupgrade_stars().value_or_empty()); + + uint64(action.vupgrade_stars().value_or_empty()); }, [](const MTPDstarGiftUnique &) { return uint64(); }); diff --git a/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp b/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp index cd0f28494..8d08dda23 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp @@ -79,6 +79,8 @@ TextWithEntities PremiumGift::subtitle() { if (starGift()) { return !_data.message.empty() ? _data.message + : _data.refunded + ? tr::lng_action_gift_refunded(tr::now, Ui::Text::RichLangValue) : outgoingGift() ? (_data.starsUpgradedBySender ? tr::lng_action_gift_sent_upgradable( diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index a6e02400d..b751ab036 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -1853,7 +1853,7 @@ void DetailsFiller::setupAboutVerification() { Ui::AddDivider(inner); } else if (!info->description.empty()) { Ui::AddDividerText(inner, rpl::single(info->description)); - } else if (_peer->verifiedByTelegram()) { + } else if (peer->verifiedByTelegram()) { const auto phrases = PeerVerifyPhrases(peer); Ui::AddDividerText(inner, phrases.telegram()); } diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index 51984ac8b..6c6333957 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -1182,7 +1182,10 @@ void ReceiptCreditsBox( box, object_ptr( box, - (e.starsUpgradedBySender + (e.giftRefunded + ? tr::lng_action_gift_refunded( + Ui::Text::RichLangValue) + : e.starsUpgradedBySender ? tr::lng_action_gift_got_upgradable_text( Ui::Text::RichLangValue) : ((couldConvert || nonConvertible) @@ -1211,6 +1214,9 @@ void ReceiptCreditsBox( tr::lng_paid_about_link_url(tr::now)); return false; }); + if (e.giftRefunded) { + about->setTextColorOverride(st::menuIconAttentionColor->c); + } } else if (isStarGift) { } else if (e.gift || isPrize) { Ui::AddSkip(content); @@ -1370,7 +1376,8 @@ void ReceiptCreditsBox( }); }; const auto canToggle = (canConvert || couldConvert || nonConvertible) - && !e.giftTransferred; + && !e.giftTransferred + && !e.giftRefunded; AddStarGiftTable( controller, @@ -1681,6 +1688,7 @@ void StarGiftViewBox( .anonymous = data.anonymous, .stargift = true, .giftTransferred = data.transferred, + .giftRefunded = data.refunded, .savedToProfile = data.saved, .canUpgradeGift = data.upgradable, .hasGiftComment = !data.message.empty(),