diff --git a/client/coral-plugin-commentbox/CommentForm.js b/client/coral-plugin-commentbox/CommentForm.js index dc27a1906..5dc52af4f 100644 --- a/client/coral-plugin-commentbox/CommentForm.js +++ b/client/coral-plugin-commentbox/CommentForm.js @@ -85,8 +85,8 @@ export class CommentForm extends React.Component { const body = this.state.body; const length = body.length; - const isNotValidLength = (length) => !length || (maxCharCount && length > maxCharCount); - const disablePostComment = (charCountEnable && isNotValidLength(length)) || ! saveCommentEnabled({body}); + const isRespectingMaxCount = (length) => charCountEnable && maxCharCount && length > maxCharCount; + const disablePostComment = !length || isRespectingMaxCount(length) || !saveCommentEnabled({body}); return
@@ -106,8 +106,8 @@ export class CommentForm extends React.Component { rows={3}/>
- { - this.props.charCountEnable && + { + this.props.charCountEnable &&
maxCharCount ? `${name}-char-max` : ''}`}> {maxCharCount && `${maxCharCount - length} ${lang.t('characters-remaining')}`}