filter whole channels
This commit is contained in:
parent
a5eccb9a92
commit
90e7821283
2 changed files with 10 additions and 2 deletions
|
@ -103,7 +103,7 @@ def search_support_count(**constraints) -> int:
|
|||
|
||||
|
||||
channel_claim = Claim.alias('channel')
|
||||
BASE_SELECT_CLAIM_COLUMNS = BASE_SELECT_TXO_COLUMNS + [
|
||||
BASE_SELECT_CLAIM_COLUMNS = [Claim.c.claim_hash.distinct()] + BASE_SELECT_TXO_COLUMNS + [
|
||||
Claim.c.activation_height,
|
||||
Claim.c.takeover_height,
|
||||
Claim.c.creation_height,
|
||||
|
@ -278,7 +278,10 @@ 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) | (ClaimFilter.c.claim_hash == Claim.c.reposted_claim_hash), isouter=True)
|
||||
.join(ClaimFilter,
|
||||
(ClaimFilter.c.claim_hash == Claim.c.claim_hash) |
|
||||
(ClaimFilter.c.claim_hash == Claim.c.reposted_claim_hash) |
|
||||
(ClaimFilter.c.claim_hash == Claim.c.channel_hash), isouter=True)
|
||||
), **constraints
|
||||
)
|
||||
|
||||
|
|
|
@ -1400,6 +1400,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), 2)
|
||||
await self.create_claim(sign=moderator_chan, name="blocking_bad", repost=user_chan.claim_id)
|
||||
await self.generate(1)
|
||||
results = await self.db.search_claims(channel="@some_channel")
|
||||
self.assertEqual(len(results.rows), 0)
|
||||
self.assertEqual(results.censor.censored.get(moderator_chan.claim_hash), 3) # good, bad and repost
|
||||
|
||||
|
||||
@skip
|
||||
|
|
Loading…
Add table
Reference in a new issue