From efb566bcc79faf33b9db3e16b796cfcf417eb7d1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 12 May 2025 14:52:01 +0400 Subject: [PATCH] Don't show resale gifts as "sold out". --- Telegram/SourceFiles/boxes/star_gift_box.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index 977c5696c4..ed44a58653 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -2940,7 +2940,27 @@ void AddBlock( }); } } else { + // First, gather information about which gifts are available on resale + base::flat_set resaleGiftIds; + if (price != kPriceTabResale) { + // Only need this info when not viewing the resale tab + for (const auto &gift : gifts) { + if (gift.resale) { + resaleGiftIds.insert(gift.info.id); + } + } + } + const auto pred = [&](const GiftTypeStars &gift) { + // Skip sold out gifts if they're available on resale + // (unless we're specifically viewing resale gifts) + if (price != kPriceTabResale && + IsSoldOut(gift.info) && + !gift.resale && + resaleGiftIds.contains(gift.info.id)) { + return true; // Remove this gift + } + return (price == kPriceTabLimited) ? (!gift.info.limitedCount) : (price == kPriceTabResale)