<commit_before>/* global React */

(function(root) {
  'use strict';
  root.Comments = React.createClass({
    getInitialState: function () {
      return({comments: [], users: []});
    },
    _onChange: function () {
      this.setState({comments: root.CommentStore.findByPostId(this.props.post), users: root.UserStore.users()});
    },
    componentDidMount: function () {
      root.CommentUtil.all();
      root.UserUtil.fetch();
      root.CommentStore.addChangeListener(this._onChange);
      root.UserStore.addChangeListener(this._onChange);
    },
    componentWillUnmount: function () {
      root.CommentStore.removeChangeListener(this._onChange);
      root.UserStore.removeChangeListener(this._onChange);
    },
    findUser: function(id) {
      var foundUser = "";
      this.state.users.forEach(function(user){
        if (user.id == id){
          foundUser = user;
        }
      });
      return foundUser.user_name;
    },
    delete: function(id) {
      root.CommentUtil.destroy(id);
    },
    render: function () {
      var filler = "... loading"
      var that = this;
      return(
         <ul>
           {that.state.comments.map(function(el){
             return <li key={el.id}><img className="small-prof-pic" src={window.CURRENT_USER_PROFILE_PIC}/>{el.body}
                 <h6>{
                   jQuery.timeago(el.created_at)} by {that.state.users.length > 0 ? that.findUser(el.user_id) : filler}
                 </h6><a onClick={that.delete.bind(that, el.id)}>Delete</a>
               </li>;
           })}
         </ul>
      );
    }
  });
}(this));<commit_msg>change prof pic of commenter<commit_after>/* global React */

(function(root) {
  'use strict';
  root.Comments = React.createClass({
    getInitialState: function () {
      return({comments: [], users: []});
    },
    _onChange: function () {
      this.setState({comments: root.CommentStore.findByPostId(this.props.post), users: root.UserStore.users()});
    },
    componentDidMount: function () {
      root.CommentUtil.all();
      root.UserUtil.fetch();
      root.CommentStore.addChangeListener(this._onChange);
      root.UserStore.addChangeListener(this._onChange);
    },
    componentWillUnmount: function () {
      root.CommentStore.removeChangeListener(this._onChange);
      root.UserStore.removeChangeListener(this._onChange);
    },
    findUser: function(id) {
      var foundUser = "";
      this.state.users.forEach(function(user){
        if (user.id == id){
          foundUser = user;
        }
      });
      return foundUser;
    },
    delete: function(id) {
      root.CommentUtil.destroy(id);
    },
    render: function () {
      var filler = "... loading"
      var that = this;
      return(
         <ul>
           {that.state.comments.map(function(el){
             return <li key={el.id}><img className="small-prof-pic" src={that.state.users.length > 0 ? that.findUser(el.user_id).url_string : ""}/>{el.body}
                 <h6>{
                   jQuery.timeago(el.created_at)} by {that.state.users.length > 0 ? that.findUser(el.user_id).user_name : filler}
                 </h6><a onClick={that.delete.bind(that, el.id)}>Delete</a>
               </li>;
           })}
         </ul>
      );
    }
  });
}(this));
{'fraction_non_alphanumeric': 0.15813668403309838, 'fraction_numerical': 0.0021452650934722646, 'mean_word_length': 2.330612244897959, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 24, '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': '6640095', 'n_tokens_mistral': 1009, 'n_tokens_neox': 995, 'n_words': 150}