Fix slow mode error message
It won't work with the hardcoded value. Still waiting for commentron (error code + data) enhancement. It's pretty weird having to parse the number, then add it back in.
This commit is contained in:
parent
33fb1501b8
commit
5769a27151
2 changed files with 8 additions and 4 deletions
|
@ -1445,7 +1445,7 @@
|
|||
"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 creator has set a minimum time gap between comments. Try again later.": "The creator has set a minimum time gap between comments. Try again later.",
|
||||
"Slow mode is on. Please wait up to %value% seconds before commenting again.": "Slow mode is on. Please wait up to %value% seconds before commenting again.",
|
||||
"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.",
|
||||
|
|
|
@ -340,16 +340,20 @@ export function doCommentCreate(
|
|||
case 'comments are disabled by the creator':
|
||||
toastMessage = __('Unable to comment. The content owner has disabled comments.');
|
||||
break;
|
||||
case 'Slow mode is on. Please wait at most 7 seconds before commenting again.':
|
||||
toastMessage = __('Slow mode is on. Please wait up to 7 seconds before commenting again.');
|
||||
break;
|
||||
default:
|
||||
const BLOCKED_WORDS_ERR_MSG = 'the comment contents are blocked by';
|
||||
const SLOW_MODE_PARTIAL_ERR_MSG = 'Slow mode is on. Please wait at most';
|
||||
|
||||
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,
|
||||
});
|
||||
} else if (error.message.startsWith(SLOW_MODE_PARTIAL_ERR_MSG)) {
|
||||
const value = error.message.replace(/\D/g, '');
|
||||
toastMessage = __('Slow mode is on. Please wait up to %value% seconds before commenting again.', {
|
||||
value,
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue