filter reposts

This commit is contained in:
Victor Shyba 2020-11-05 18:20:14 -03:00 committed by Lex Berezhny
parent f83289f876
commit a5eccb9a92
2 changed files with 6 additions and 1 deletions

View file

@ -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
)

View file

@ -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