Error toast for non-anonymous comment constraint

This commit is contained in:
Oleg Silkin 2020-02-25 08:52:30 -05:00
parent 916e5d0efa
commit c3395c9c58

View file

@ -50,10 +50,26 @@ export function doCommentCreate(
dispatch({ dispatch({
type: ACTIONS.COMMENT_CREATE_STARTED, type: ACTIONS.COMMENT_CREATE_STARTED,
}); });
const myChannels = selectMyChannelClaims(state); const myChannels = selectMyChannelClaims(state);
const namedChannelClaim = const namedChannelClaim =
myChannels && myChannels.find(myChannel => myChannel.name === channel); 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({ return Lbry.comment_create({
comment: comment, comment: comment,
claim_id: claim_id, claim_id: claim_id,