claim_list resolve of blocked claims

This commit is contained in:
Lex Berezhny 2022-10-03 10:44:27 -04:00
parent d0aad8ccaf
commit 677d9053de
2 changed files with 14 additions and 2 deletions

View file

@ -993,7 +993,13 @@ class Ledger(metaclass=LedgerRegistry):
results.append(resolved) results.append(resolved)
else: else:
if isinstance(resolved, dict) and 'error' in resolved: if isinstance(resolved, dict) and 'error' in resolved:
txo.meta['error'] = resolved['error'] if resolved['error'].get('name') == 'BLOCKED' and txo.is_claim and txo.claim.is_repost:
txo.meta['blocked_repost'] = await self.get_claim_by_claim_id(
txo.claim.repost.reference.claim_id,
accounts=accounts
)
else:
txo.meta['error'] = resolved['error']
results.append(txo) results.append(txo)
return results return results

View file

@ -1643,7 +1643,9 @@ class StreamCommands(ClaimTestCase):
# block channel # block channel
self.assertEqual(0, len(self.conductor.spv_node.server.db.blocked_channels)) self.assertEqual(0, len(self.conductor.spv_node.server.db.blocked_channels))
await self.stream_repost(bad_channel_id, 'block2', '0.1', channel_name='@blocking') blocked_repost_id = self.get_claim_id(
await self.stream_repost(bad_channel_id, 'block2', '0.1', channel_name='@blocking')
)
self.assertEqual(1, len(self.conductor.spv_node.server.db.blocked_channels)) self.assertEqual(1, len(self.conductor.spv_node.server.db.blocked_channels))
# channel, claim in channel or claim individually no longer resolve # channel, claim in channel or claim individually no longer resolve
@ -1656,6 +1658,10 @@ class StreamCommands(ClaimTestCase):
self.assertEqual((await self.resolve('lbry://worse_content'))['error']['name'], 'BLOCKED') self.assertEqual((await self.resolve('lbry://worse_content'))['error']['name'], 'BLOCKED')
self.assertEqual((await self.resolve('lbry://@bad_channel/worse_content'))['error']['name'], 'BLOCKED') self.assertEqual((await self.resolve('lbry://@bad_channel/worse_content'))['error']['name'], 'BLOCKED')
# blocked claim should still show in local claim list
claims = await self.claim_list(claim_id=blocked_repost_id, resolve=True)
self.assertIn('blocked_repost', claims[0]['meta'])
async def test_publish_updates_file_list(self): async def test_publish_updates_file_list(self):
tx = await self.stream_create(title='created') tx = await self.stream_create(title='created')
txo = tx['outputs'][0] txo = tx['outputs'][0]