forked from LBRYCommunity/lbry-sdk
Simplifies
This commit is contained in:
parent
89c0b5dbdf
commit
49b42b7e03
1 changed files with 10 additions and 17 deletions
|
@ -3497,40 +3497,33 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
response['is_claim_signature_valid'] = is_comment_signed_by_channel(response, channel)
|
response['is_claim_signature_valid'] = is_comment_signed_by_channel(response, channel)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
async def jsonrpc_comment_abandon(self, comment_id, channel_name=None, channel_id=None, channel_account_id=None):
|
async def jsonrpc_comment_abandon(self, comment_id):
|
||||||
""""
|
""""
|
||||||
Delete a comment published under your channel identity
|
Delete a comment published under your channel identity
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
comment_delete (<comment_id> | --comment_id=<comment_id>)
|
comment_delete (<comment_id> | --comment_id=<comment_id>)
|
||||||
(--channel_id=<channel_id> | --channel_name=<channel_name>)
|
|
||||||
[--channel_account_id=<channel_account_id>...]
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--comment_id=<comment_id> : (str) The ID of the comment to be deleted.
|
--comment_id=<comment_id> : (str) The ID of the comment to be deleted.
|
||||||
--channel_id=<channel_id> : (str) The ID of the channel that posted the comment.
|
|
||||||
--channel_name=<channel_name> : (str) The Name of the channel that posted the comment..
|
|
||||||
--channel_account_id=<channel_account_id> : (str) one or more account ids for accounts to look in
|
|
||||||
for channel certificates, defaults to all accounts.
|
|
||||||
Returns:
|
Returns:
|
||||||
"""
|
"""
|
||||||
abandon_comment_body = {'comment_id': comment_id}
|
abandon_comment_body = {'comment_id': comment_id}
|
||||||
if not channel_name and not channel_id:
|
channel = await jsonrpc_post(
|
||||||
chan = await jsonrpc_post(
|
self.conf.comment_server, 'get_channel_from_comment_id', comment_id=comment_id
|
||||||
self.conf.comment_server, 'get_channel_from_comment_id', comment_id=comment_id
|
)
|
||||||
)
|
|
||||||
channel_id = chan.get('channel_id')
|
|
||||||
channel_name = chan.get('channel_name')
|
|
||||||
|
|
||||||
channel = await self.get_channel_or_none(channel_account_id, channel_id, channel_name, for_signing=True)
|
|
||||||
if not channel:
|
if not channel:
|
||||||
raise Exception('You must own the channel to delete the comment')
|
return {comment_id: {'deleted': False}}
|
||||||
|
channel = await self.get_channel_or_none(None, **channel)
|
||||||
abandon_comment_body.update({
|
abandon_comment_body.update({
|
||||||
'channel_id': channel.claim_id,
|
'channel_id': channel.claim_id,
|
||||||
'channel_name': channel.claim_name,
|
'channel_name': channel.claim_name,
|
||||||
})
|
})
|
||||||
sign_abandon_comment(abandon_comment_body, channel)
|
sign_abandon_comment(abandon_comment_body, channel)
|
||||||
return await jsonrpc_post(self.conf.comment_server, 'delete_comment', abandon_comment_body)
|
resp = await jsonrpc_post(self.conf.comment_server, 'delete_comment', abandon_comment_body)
|
||||||
|
return {comment_id: resp}
|
||||||
|
|
||||||
async def broadcast_or_release(self, account, tx, blocking=False):
|
async def broadcast_or_release(self, account, tx, blocking=False):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue