From 75768fd7fdf9a081d4e16317702803f25a880173 Mon Sep 17 00:00:00 2001 From: Mikhail Alpinskiy Date: Thu, 1 Oct 2026 16:25:02 +0300 Subject: [PATCH] blacklist NFT items of a blacklisted collection An item-level graylist/whitelist verdict used to win over the collection's ban, so items of a banned collection stayed visible. The collection's blacklist now takes precedence over the item's own review. Co-Authored-By: Claude Opus 5.5 --- pkg/api/nft_converters.go | 4 ++++ pkg/api/nft_converters_test.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/pkg/api/nft_converters.go b/pkg/api/nft_converters.go index 59e594b5..bbb520fe 100644 --- a/pkg/api/nft_converters.go +++ b/pkg/api/nft_converters.go @@ -86,6 +86,10 @@ func (h *Handler) convertNFT(ctx context.Context, item core.NftItem, book addres switch { case len(nftItem.ApprovedBy) > 0 && nftItem.Verified: nftItem.Trust = oas.TrustType(core.TrustWhitelist) + case item.CollectionAddress != nil && collectionTrust == core.TrustBlacklist: + // A banned collection taints every item in it, even one reviewed and cleared on its own: + // the item-level verdict usually predates the collection's ban. + nftItem.Trust = oas.TrustType(core.TrustBlacklist) case trustType == core.TrustWhitelist || trustType == core.TrustGraylist: // The item has been reviewed and cleared (support graylisted it, for instance). That // verdict wins over whatever the spam filter's heuristics would otherwise return. diff --git a/pkg/api/nft_converters_test.go b/pkg/api/nft_converters_test.go index 3539f145..e13cd09d 100644 --- a/pkg/api/nft_converters_test.go +++ b/pkg/api/nft_converters_test.go @@ -123,6 +123,20 @@ func TestConvertNFTTrust(t *testing.T) { trustType: core.TrustGraylist, expectedTrust: oas.TrustType(core.TrustGraylist), }, + { + name: "a graylisted item in a blacklisted collection is blacklisted", + collection: &collectionID, + collectionTrust: core.TrustBlacklist, + trustType: core.TrustGraylist, + expectedTrust: oas.TrustType(core.TrustBlacklist), + }, + { + name: "a whitelisted item in a blacklisted collection is blacklisted", + collection: &collectionID, + collectionTrust: core.TrustBlacklist, + trustType: core.TrustWhitelist, + expectedTrust: oas.TrustType(core.TrustBlacklist), + }, { name: "a whitelisted item stays visible even without a collection", collection: nil,