<commit_before>class CommentsSection extends React.Component {
  constructor(props) {
    super(props);
    this.state = { comments: this.props.current_comments };
  }
  saveNewComment(e) {
    e.preventDefault();
    let $form = $(e.target);
    let $gcText = $form.find("#gc-text");
    $.post(`/grants/${this.props.grant.id}/add_comment`, { body: $gcText.val() })
    .done(resp => {
      let currentComments = this.state.comments;
      currentComments.unshift(resp);
      this.setState({ comments: currentComments });
      $gcText.val("");
    })
    .fail(errors => console.log(errors));
  }
  render() {
    return (
      <div className="well">
        <h4>Comments</h4>
        <CommentForm handleSubmit={this.saveNewComment.bind(this)} />
        {this.state.comments.map(comment => <Comment key={comment.id} {...comment} />)}
      </div>
    );
  }
}
<commit_msg>Prevent users from submitting a blank comment<commit_after>class CommentsSection extends React.Component {
  constructor(props) {
    super(props);
    this.state = { comments: this.props.current_comments };
  }
  saveNewComment(e) {
    e.preventDefault();
    let $form = $(e.target);
    let $gcText = $form.find("#gc-text");
    if ($.trim($gcText.val())) {
      $.post(`/grants/${this.props.grant.id}/add_comment`, { body: $gcText.val() })
      .done(resp => {
        let currentComments = this.state.comments;
        currentComments.unshift(resp);
        this.setState({ comments: currentComments });
        $gcText.val("");
      })
      .fail(errors => console.log(errors));
    }
  }
  render() {
    return (
      <div className="well">
        <h4>Comments</h4>
        <CommentForm handleSubmit={this.saveNewComment.bind(this)} />
        {this.state.comments.map(comment => <Comment key={comment.id} {...comment} />)}
      </div>
    );
  }
}

{'fraction_non_alphanumeric': 0.17905588714053175, 'fraction_numerical': 0.002170374389582203, 'mean_word_length': 2.8336798336798337, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1081853', 'n_tokens_mistral': 591, 'n_tokens_neox': 587, 'n_words': 94}