From a5eccb9a9204ad8dfb59cf4eff04cc657db8d938 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Thu, 5 Nov 2020 18:20:14 -0300 Subject: [PATCH] filter reposts --- lbry/db/queries/search.py | 2 +- tests/integration/blockchain/test_blockchain.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lbry/db/queries/search.py b/lbry/db/queries/search.py index d598576fe..0401baffb 100644 --- a/lbry/db/queries/search.py +++ b/lbry/db/queries/search.py @@ -278,7 +278,7 @@ def select_claims(cols: List = None, for_count=False, **constraints) -> Select: .select_from( Claim.join(TXO).join(TX).join(Trending, Trending.c.claim_hash == Claim.c.claim_hash, isouter=True) .join(channel_claim, Claim.c.channel_hash == channel_claim.c.claim_hash, isouter=True) - .join(ClaimFilter, ClaimFilter.c.claim_hash == Claim.c.claim_hash, isouter=True) + .join(ClaimFilter, (ClaimFilter.c.claim_hash == Claim.c.claim_hash) | (ClaimFilter.c.claim_hash == Claim.c.reposted_claim_hash), isouter=True) ), **constraints ) diff --git a/tests/integration/blockchain/test_blockchain.py b/tests/integration/blockchain/test_blockchain.py index 89a07c987..09b159a6d 100644 --- a/tests/integration/blockchain/test_blockchain.py +++ b/tests/integration/blockchain/test_blockchain.py @@ -1395,6 +1395,11 @@ class TestClaimtrieSync(SyncingBlockchainTestCase): results = await self.db.search_claims(channel="@some_channel") self.assertEqual(len(results.rows), 1) self.assertEqual(results.censor.censored.get(moderator_chan.claim_hash), 1) + await self.create_claim(sign=user_chan, name="reposting_bad", repost=bad_content.claim_id) + await self.generate(1) + results = await self.db.search_claims(channel="@some_channel") + self.assertEqual(len(results.rows), 1) + self.assertEqual(results.censor.censored.get(moderator_chan.claim_hash), 2) @skip