Error toast for non-anonymous comment constraint
This commit is contained in:
parent
916e5d0efa
commit
c3395c9c58
1 changed files with 17 additions and 1 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue