Relay and beautify 'blocked words' error message
This commit is contained in:
parent
2b70ad667b
commit
8050fa24b2
2 changed files with 13 additions and 0 deletions
|
@ -1422,6 +1422,8 @@
|
||||||
"Controversial": "Controversial",
|
"Controversial": "Controversial",
|
||||||
"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.",
|
||||||
|
"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.",
|
||||||
"Unable to edit this comment, please try again later.": "Unable to edit this comment, please try again later.",
|
"Unable to edit this comment, please try again later.": "Unable to edit this comment, please try again later.",
|
||||||
|
|
|
@ -309,6 +309,17 @@ export function doCommentCreate(
|
||||||
toastMessage = __('Unable to comment. This channel has blocked you.');
|
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(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
message: toastMessage,
|
message: toastMessage,
|
||||||
|
|
Loading…
Reference in a new issue