Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/api/nft_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 14 additions & 0 deletions pkg/api/nft_converters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading