diff --git a/static/app-strings.json b/static/app-strings.json index a495053c0a4..1c3c52bee7a 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1422,6 +1422,8 @@ "Controversial": "Controversial", "Show Replies": "Show Replies", "Unable to create comment, please try again later.": "Unable to create comment, please try again later.", + "Unable to comment. This channel has blocked you.": "Unable to comment. This channel has blocked you.", + "The comment contains contents that are blocked by %author%": "The comment contains contents that are blocked by %author%", "Your channel is still being setup, try again in a few moments.": "Your channel is still being setup, try again in a few moments.", "Unable to delete this comment, please try again later.": "Unable to delete this comment, please try again later.", "Unable to edit this comment, please try again later.": "Unable to edit this comment, please try again later.", diff --git a/ui/redux/actions/comments.js b/ui/redux/actions/comments.js index b98b01b08ac..36a3a5a0578 100644 --- a/ui/redux/actions/comments.js +++ b/ui/redux/actions/comments.js @@ -309,6 +309,17 @@ export function doCommentCreate( toastMessage = __('Unable to comment. This channel has blocked you.'); } + if (error) { + const BLOCKED_WORDS_ERR_MSG = 'the comment contents are blocked by'; + + if (error.message === 'channel is blocked by publisher') { + toastMessage = __('Unable to comment. This channel has blocked you.'); + } else if (error.message.startsWith(BLOCKED_WORDS_ERR_MSG)) { + const channelName = error.message.substring(BLOCKED_WORDS_ERR_MSG.length); + toastMessage = __('The comment contains contents that are blocked by %author%', { author: channelName }); + } + } + dispatch( doToast({ message: toastMessage,