forked from LBRYCommunity/lbry-sdk
Makes claim_id
and parent_id
mutually exclusive for comment create
This commit is contained in:
parent
78606ed4b8
commit
832020fa81
3 changed files with 10 additions and 6 deletions
|
@ -4503,15 +4503,14 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@requires(WALLET_COMPONENT)
|
@requires(WALLET_COMPONENT)
|
||||||
async def jsonrpc_comment_create(self, claim_id, comment, parent_id=None, channel_account_id=None,
|
async def jsonrpc_comment_create(self, comment, claim_id=None, parent_id=None, channel_account_id=None,
|
||||||
channel_name=None, channel_id=None, wallet_id=None):
|
channel_name=None, channel_id=None, wallet_id=None):
|
||||||
"""
|
"""
|
||||||
Create and associate a comment with a claim using your channel identity.
|
Create and associate a comment with a claim using your channel identity.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
comment_create (<comment> | --comment=<comment>)
|
comment_create (<comment> | --comment=<comment>)
|
||||||
(<claim_id> | --claim_id=<claim_id>)
|
(<claim_id> | --claim_id=<claim_id> | --parent_id=<parent_id>)
|
||||||
[--parent_id=<parent_id>]
|
|
||||||
[--channel_id=<channel_id>] [--channel_name=<channel_name>]
|
[--channel_id=<channel_id>] [--channel_name=<channel_name>]
|
||||||
[--channel_account_id=<channel_account_id>...] [--wallet_id=<wallet_id>]
|
[--channel_account_id=<channel_account_id>...] [--wallet_id=<wallet_id>]
|
||||||
|
|
||||||
|
|
|
@ -336,8 +336,7 @@ class Examples(CommandTestCase):
|
||||||
'You can r',
|
'You can r',
|
||||||
'comment', 'create',
|
'comment', 'create',
|
||||||
'--comment="I have photographic evidence confirming Sasquatch exists"',
|
'--comment="I have photographic evidence confirming Sasquatch exists"',
|
||||||
f'--channel_name=@channel', f'--claim_id={stream_id}',
|
f'--channel_name=@channel', f'--parent_id={comment["comment_id"]}'
|
||||||
f'--parent_id={comment["comment_id"]}'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
await r(
|
await r(
|
||||||
|
|
|
@ -47,15 +47,21 @@ class MockedCommentServer:
|
||||||
schema.update(**kwargs)
|
schema.update(**kwargs)
|
||||||
return schema
|
return schema
|
||||||
|
|
||||||
def create_comment(self, channel_name=None, channel_id=None, **kwargs):
|
def create_comment(self, claim_id=None, parent_id=None, channel_name=None, channel_id=None, **kwargs):
|
||||||
comment_id = self.comment_id
|
comment_id = self.comment_id
|
||||||
channel_url = 'lbry://' + channel_name + '#' + channel_id if channel_id else None
|
channel_url = 'lbry://' + channel_name + '#' + channel_id if channel_id else None
|
||||||
|
|
||||||
|
if parent_id:
|
||||||
|
claim_id = self.comments[self.get_comment_id(parent_id)]['claim_id']
|
||||||
|
|
||||||
comment = self._create_comment(
|
comment = self._create_comment(
|
||||||
comment_id=str(comment_id),
|
comment_id=str(comment_id),
|
||||||
channel_name=channel_name,
|
channel_name=channel_name,
|
||||||
channel_id=channel_id,
|
channel_id=channel_id,
|
||||||
channel_url=channel_url,
|
channel_url=channel_url,
|
||||||
timestamp=str(int(time.time())),
|
timestamp=str(int(time.time())),
|
||||||
|
claim_id=claim_id,
|
||||||
|
parent_id=parent_id,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
self.comments.append(comment)
|
self.comments.append(comment)
|
||||||
|
|
Loading…
Reference in a new issue