From c3395c9c58289176d1ddb3352b728c49bfcdda56 Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Tue, 25 Feb 2020 08:52:30 -0500 Subject: [PATCH] Error toast for non-anonymous comment constraint --- src/redux/actions/comments.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/redux/actions/comments.js b/src/redux/actions/comments.js index a150a88..22b38e4 100644 --- a/src/redux/actions/comments.js +++ b/src/redux/actions/comments.js @@ -50,10 +50,26 @@ export function doCommentCreate( dispatch({ type: ACTIONS.COMMENT_CREATE_STARTED, }); + const myChannels = selectMyChannelClaims(state); const namedChannelClaim = myChannels && myChannels.find(myChannel => myChannel.name === channel); - const channel_id = namedChannelClaim ? namedChannelClaim.claim_id : null; + const channel_id = namedChannelClaim.claim_id; + + if (channel_id == null) { + dispatch({ + type: ACTIONS.COMMENT_CREATE_FAILED, + data: {}, + }); + dispatch( + doToast({ + message: 'Channel cannot be anonymous, please select a channel and try again.', + isError: true, + }) + ); + return; + } + return Lbry.comment_create({ comment: comment, claim_id: claim_id,