diff --git a/Telegram/SourceFiles/api/api_premium.cpp b/Telegram/SourceFiles/api/api_premium.cpp index dcb9d303f9..545ef29be3 100644 --- a/Telegram/SourceFiles/api/api_premium.cpp +++ b/Telegram/SourceFiles/api/api_premium.cpp @@ -992,6 +992,7 @@ std::optional FromTL( ? peerFromMTP(*data.vfrom_id()) : PeerId()), .date = data.vdate().v, + .upgradeSeparate = data.is_upgrade_separate(), .upgradable = data.is_can_upgrade(), .anonymous = data.is_name_hidden(), .pinned = data.is_pinned_to_top() && hasUnique, diff --git a/Telegram/SourceFiles/data/data_credits.h b/Telegram/SourceFiles/data/data_credits.h index 1cf1670408..5102d58a4b 100644 --- a/Telegram/SourceFiles/data/data_credits.h +++ b/Telegram/SourceFiles/data/data_credits.h @@ -106,6 +106,7 @@ struct CreditsHistoryEntry final { bool giftTransferred : 1 = false; bool giftRefunded : 1 = false; bool giftUpgraded : 1 = false; + bool giftUpgradeSeparate : 1 = false; bool giftResale : 1 = false; bool giftResaleForceTon : 1 = false; bool giftPinned : 1 = false; diff --git a/Telegram/SourceFiles/data/data_media_types.h b/Telegram/SourceFiles/data/data_media_types.h index c793bb1234..a8fce546d0 100644 --- a/Telegram/SourceFiles/data/data_media_types.h +++ b/Telegram/SourceFiles/data/data_media_types.h @@ -163,6 +163,7 @@ struct GiftCode { GiftType type = GiftType::Premium; bool viaGiveaway : 1 = false; bool transferred : 1 = false; + bool upgradeSeparate : 1 = false; bool upgradable : 1 = false; bool unclaimed : 1 = false; bool anonymous : 1 = false; diff --git a/Telegram/SourceFiles/data/data_star_gift.h b/Telegram/SourceFiles/data/data_star_gift.h index 19e1af0987..c9e41a84cd 100644 --- a/Telegram/SourceFiles/data/data_star_gift.h +++ b/Telegram/SourceFiles/data/data_star_gift.h @@ -178,6 +178,7 @@ struct SavedStarGift { QString giftPrepayUpgradeHash; PeerId fromId = 0; TimeId date = 0; + bool upgradeSeparate = false; bool upgradable = false; bool anonymous = false; bool pinned = false; diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 3d6de77155..47b8410f45 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -5869,13 +5869,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { const MTPDmessageActionStarGift &action) { auto result = PreparedServiceText(); const auto upgradeGifted = action.is_prepaid_upgrade(); + const auto upgradeSeparate = action.is_upgrade_separate(); const auto isSelf = _from->isSelf(); const auto peer = isSelf ? _history->peer : _from; const auto stars = action.vgift().match([&]( const MTPDstarGift &data) { return upgradeGifted ? uint64(action.vupgrade_stars().value_or_empty()) - : action.is_upgrade_separate() + : upgradeSeparate ? uint64(data.vstars().v) : (uint64(data.vstars().v) + uint64(action.vupgrade_stars().value_or_empty())); @@ -6503,6 +6504,7 @@ void HistoryItem::applyAction(const MTPMessageAction &action) { .starsUpgradedBySender = int( data.vupgrade_stars().value_or_empty()), .type = Data::GiftType::StarGift, + .upgradeSeparate = data.is_upgrade_separate(), .upgradable = data.is_can_upgrade(), .anonymous = data.is_name_hidden(), .converted = data.is_converted(), diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index 291110acf4..d988a14023 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -1874,7 +1874,9 @@ void GenericCreditsEntryBox( && e.hasGiftComment), .canAddMyComment = (giftToSelf && e.hasGiftComment), .addDetailsDefault = (giftToSelf - || (e.starsUpgradedBySender && !e.anonymous)), + || (e.starsUpgradedBySender + && !e.giftUpgradeSeparate + && !e.anonymous)), }); }; @@ -2553,6 +2555,7 @@ Data::CreditsHistoryEntry SavedStarGiftEntry( .converted = false, .anonymous = data.anonymous, .stargift = true, + .giftUpgradeSeparate = data.upgradeSeparate, .giftPinned = data.pinned, .savedToProfile = !data.hidden, .fromGiftsList = true, @@ -2657,6 +2660,7 @@ void ShowStarGiftViewBox( .stargift = true, .giftTransferred = data.transferred, .giftRefunded = data.refunded, + .giftUpgradeSeparate = data.upgradeSeparate, .savedToProfile = data.saved, .canUpgradeGift = data.upgradable, .hasGiftComment = !data.message.empty(),