From 49b42b7e034a06ccc1b4b1fe3d435fa955d52e23 Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Sat, 20 Jul 2019 14:28:45 -0400 Subject: [PATCH] Simplifies --- lbry/lbry/extras/daemon/Daemon.py | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/lbry/lbry/extras/daemon/Daemon.py b/lbry/lbry/extras/daemon/Daemon.py index 3fac4f971..0d5e6efd4 100644 --- a/lbry/lbry/extras/daemon/Daemon.py +++ b/lbry/lbry/extras/daemon/Daemon.py @@ -3497,40 +3497,33 @@ class Daemon(metaclass=JSONRPCServerType): response['is_claim_signature_valid'] = is_comment_signed_by_channel(response, channel) 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 Usage: comment_delete ( | --comment_id=) - (--channel_id= | --channel_name=) - [--channel_account_id=...] + Options: --comment_id= : (str) The ID of the comment to be deleted. - --channel_id= : (str) The ID of the channel that posted the comment. - --channel_name= : (str) The Name of the channel that posted the comment.. - --channel_account_id= : (str) one or more account ids for accounts to look in - for channel certificates, defaults to all accounts. + Returns: """ abandon_comment_body = {'comment_id': comment_id} - if not channel_name and not channel_id: - chan = await jsonrpc_post( - 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) + channel = await jsonrpc_post( + self.conf.comment_server, 'get_channel_from_comment_id', comment_id=comment_id + ) 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({ 'channel_id': channel.claim_id, 'channel_name': channel.claim_name, }) 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): try: