diff --git a/static/app-strings.json b/static/app-strings.json index 8de06ffbc..e12db34e2 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1437,6 +1437,8 @@ "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.", + "Unable to comment. Your channel has been blocked by an admin.": "Unable to comment. Your channel has been blocked by an admin.", + "Unable to comment. The content owner has disabled comments.": "Unable to comment. The content owner has disabled comments.", "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.", diff --git a/ui/redux/actions/comments.js b/ui/redux/actions/comments.js index 4b61cb6b1..bd14bf9c3 100644 --- a/ui/redux/actions/comments.js +++ b/ui/redux/actions/comments.js @@ -329,13 +329,26 @@ export function doCommentCreate( } 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 }); + // TODO: Use error codes when commentron implements it. + switch (error.message) { + case 'channel is blocked by publisher': + toastMessage = __('Unable to comment. This channel has blocked you.'); + break; + case 'channel is not allowed to post comments': + toastMessage = __('Unable to comment. Your channel has been blocked by an admin.'); + break; + case 'comments are disabled by the creator': + toastMessage = __('Unable to comment. The content owner has disabled comments.'); + break; + default: + const BLOCKED_WORDS_ERR_MSG = 'the comment contents are blocked by'; + 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, + }); + } + break; } }