drops support for commenting without a channel

This commit is contained in:
Oleg Silkin 2020-02-26 19:58:03 -05:00
parent eca7addc67
commit e560d83c51
2 changed files with 13 additions and 13 deletions

View file

@ -4584,7 +4584,7 @@ class Daemon(metaclass=JSONRPCServerType):
Usage: Usage:
comment_create (<comment> | --comment=<comment>) comment_create (<comment> | --comment=<comment>)
(<claim_id> | --claim_id=<claim_id> | --parent_id=<parent_id>) (<claim_id> | --claim_id=<claim_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>]
Options: Options:
@ -4612,23 +4612,23 @@ class Daemon(metaclass=JSONRPCServerType):
} }
""" """
wallet = self.wallet_manager.get_wallet_or_default(wallet_id) wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
channel = await self.get_channel_or_error(
wallet, channel_account_id, channel_id, channel_name, for_signing=True
)
comment_body = { comment_body = {
'comment': comment.strip(), 'comment': comment.strip(),
'claim_id': claim_id, 'claim_id': claim_id,
'parent_id': parent_id, 'parent_id': parent_id,
'channel_id': channel.claim_id,
'channel_name': channel.claim_name,
} }
channel = await self.get_channel_or_none( comment_client.sign_comment(comment_body, channel)
wallet, channel_account_id, channel_id, channel_name, for_signing=True
)
if channel:
comment_body.update({
'channel_id': channel.claim_id,
'channel_name': channel.claim_name,
})
comment_client.sign_comment(comment_body, channel)
response = await comment_client.jsonrpc_post(self.conf.comment_server, 'create_comment', comment_body) response = await comment_client.jsonrpc_post(self.conf.comment_server, 'create_comment', comment_body)
if 'signature' in response: response.update({
response['is_claim_signature_valid'] = comment_client.is_comment_signed_by_channel(response, channel) 'is_claim_signature_valid': comment_client.is_comment_signed_by_channel(response, channel)
})
return response return response
@requires(WALLET_COMPONENT) @requires(WALLET_COMPONENT)

View file

@ -333,7 +333,7 @@ class Examples(CommandTestCase):
) )
reply = await r( reply = await r(
'You can r', 'Use the parent_id param to make replies',
'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'--parent_id={comment["comment_id"]}' f'--channel_name=@channel', f'--parent_id={comment["comment_id"]}'