Show comment failure reason
## Issue 6370
This commit is contained in:
parent
22d9495b8d
commit
10c04a7991
2 changed files with 22 additions and 7 deletions
|
@ -1437,6 +1437,8 @@
|
||||||
"Show Replies": "Show Replies",
|
"Show Replies": "Show Replies",
|
||||||
"Unable to create comment, please try again later.": "Unable to create comment, please try again later.",
|
"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. 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%",
|
"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.",
|
"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 delete this comment, please try again later.": "Unable to delete this comment, please try again later.",
|
||||||
|
|
|
@ -329,13 +329,26 @@ export function doCommentCreate(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
const BLOCKED_WORDS_ERR_MSG = 'the comment contents are blocked by';
|
// TODO: Use error codes when commentron implements it.
|
||||||
|
switch (error.message) {
|
||||||
if (error.message === 'channel is blocked by publisher') {
|
case 'channel is blocked by publisher':
|
||||||
toastMessage = __('Unable to comment. This channel has blocked you.');
|
toastMessage = __('Unable to comment. This channel has blocked you.');
|
||||||
} else if (error.message.startsWith(BLOCKED_WORDS_ERR_MSG)) {
|
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);
|
const channelName = error.message.substring(BLOCKED_WORDS_ERR_MSG.length);
|
||||||
toastMessage = __('The comment contains contents that are blocked by %author%', { author: channelName });
|
toastMessage = __('The comment contains contents that are blocked by %author%', {
|
||||||
|
author: channelName,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue