forked from LBRYCommunity/lbry-sdk
claim_list doesnt blow up
This commit is contained in:
parent
578f8f4062
commit
e4aeb66257
1 changed files with 20 additions and 15 deletions
|
@ -3416,7 +3416,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
cmnt_list: dict = await jsonrpc_post(
|
result = await jsonrpc_post(
|
||||||
self.conf.comment_server,
|
self.conf.comment_server,
|
||||||
"get_claim_comments",
|
"get_claim_comments",
|
||||||
claim_id=claim_id,
|
claim_id=claim_id,
|
||||||
|
@ -3425,20 +3425,25 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
page_size=page_size,
|
page_size=page_size,
|
||||||
top_level=not include_replies
|
top_level=not include_replies
|
||||||
)
|
)
|
||||||
if cmnt_list.get('items', None):
|
|
||||||
items = cmnt_list['items']
|
for comment in result.get('items', []):
|
||||||
chnl_uris = {cmnt['channel_url'] for cmnt in items if 'channel_url' in cmnt}
|
channel_url = comment.get('channel_url')
|
||||||
claims = await self.resolve(tuple(chnl_uris))
|
if not channel_url:
|
||||||
for cmnt in cmnt_list['items']:
|
continue
|
||||||
if 'channel_url' in cmnt:
|
resolve_response = await self.resolve([channel_url])
|
||||||
if cmnt['channel_url'] in claims:
|
if 'error' not in resolve_response[channel_url]:
|
||||||
channel = claims[cmnt['channel_url']]
|
comment['is_channel_signature_valid'] = is_comment_signed_by_channel(
|
||||||
cmnt['is_channel_signature_valid'] = is_comment_signed_by_channel(cmnt, channel)
|
comment, resolve_response[channel_url]
|
||||||
continue
|
)
|
||||||
cmnt['is_channel_signature_valid'] = False
|
else:
|
||||||
if is_channel_signature_valid:
|
comment['is_channel_signature_valid'] = False
|
||||||
cmnt_list['items'] = [c for c in cmnt_list['items'] if c['is_channel_signature_valid']]
|
|
||||||
return cmnt_list
|
if is_channel_signature_valid:
|
||||||
|
result['items'] = [
|
||||||
|
c for c in result.get('items', []) if c['is_channel_signature_valid']
|
||||||
|
]
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
async def jsonrpc_comment_create(self, claim_id, comment, parent_id=None, channel_account_id=None,
|
async def jsonrpc_comment_create(self, claim_id, comment, parent_id=None, channel_account_id=None,
|
||||||
channel_name=None, channel_id=None) -> dict:
|
channel_name=None, channel_id=None) -> dict:
|
||||||
|
|
Loading…
Reference in a new issue