slight cleanup

This commit is contained in:
Lex Berezhny 2020-08-19 13:59:26 -04:00
parent 991987ed76
commit 2d7443d454
2 changed files with 3 additions and 5 deletions

View file

@ -52,9 +52,7 @@ class Censor:
if was_censored: if was_censored:
self.total += 1 self.total += 1
if not was_censored and self.limit_claims_per_channel is not None and row['channel_hash']: if not was_censored and self.limit_claims_per_channel is not None and row['channel_hash']:
if row['channel_hash'] not in self.claims_in_channel: self.claims_in_channel.setdefault(row['channel_hash'], 0)
self.claims_in_channel[row['channel_hash']] = 1
else:
self.claims_in_channel[row['channel_hash']] += 1 self.claims_in_channel[row['channel_hash']] += 1
if self.claims_in_channel[row['channel_hash']] > self.limit_claims_per_channel: if self.claims_in_channel[row['channel_hash']] > self.limit_claims_per_channel:
return True return True

View file

@ -319,7 +319,7 @@ class ClaimSearchCommand(ClaimTestCase):
not_channel_ids=[chan2_id], has_channel_signature=True, valid_channel_signature=True) not_channel_ids=[chan2_id], has_channel_signature=True, valid_channel_signature=True)
await match([], not_channel_ids=[chan1_id, chan2_id], has_channel_signature=True, valid_channel_signature=True) await match([], not_channel_ids=[chan1_id, chan2_id], has_channel_signature=True, valid_channel_signature=True)
async def test_limit_channel_results(self): async def test_limit_claims_per_channel(self):
match = self.assertFindsClaims match = self.assertFindsClaims
chan1_id = self.get_claim_id(await self.channel_create('@chan1')) chan1_id = self.get_claim_id(await self.channel_create('@chan1'))
chan2_id = self.get_claim_id(await self.channel_create('@chan2')) chan2_id = self.get_claim_id(await self.channel_create('@chan2'))