<commit_before>import React from "react/addons";
import "./Comments.css";
import Tabs from "../Tabs/Tabs.es6";

import $ from "jquery";

import superagent from "superagent";
import helper from "../../helper";
import Debug from "debug";

var debug = Debug("component:Comments");

export default React.createClass({
  displayName: "Comments",

  getInitialState(){
      return {
         focusTab: 'all',//all, editorsPick
         max: 3,
         commentData: [],
         expandedCommentId:{},
         path: location.pathname
      }
  },

  _onToggle(choice, event){
      //console.log(choice);
      this.setState({
          focusTab: choice
      });
  },

  _onSetNewMax(){
      this.setState({
          max: this.state.max + 5
      });

  },

  _onReadMore(item, event){

    var current = this.state.expandedCommentId;
    current[item.id] = true;

    this.setState({
        expandedCommentId: current
    });

  },

  getCommentData() {
    superagent
      .get(helper.topicURL(this.state.path.replace(/.*\/[^$]/, '')))
      .use(helper.withPromise())
      .end()
      .then(function (res) {
        this.setState({
          commentData: res.body.post_stream.posts
        })
      })
      .catch(function (err) {
        debug(err)
      })
  },

  // /////////////////// IMAGE URL ISSUE<commit_msg>fix posts path to id<commit_after>import React from "react/addons";
import "./Comments.css";
import Tabs from "../Tabs/Tabs.es6";

import $ from "jquery";

import superagent from "superagent";
import helper from "../../helper";
import Debug from "debug";

var debug = Debug("component:Comments");

export default React.createClass({
  displayName: "Comments",

  getInitialState(){
      return {
         focusTab: 'all',//all, editorsPick
         max: 3,
         commentData: [],
         expandedCommentId:{},
         path: location.pathname
      }
  },

  _onToggle(choice, event){
      //console.log(choice);
      this.setState({
          focusTab: choice
      });
  },

  _onSetNewMax(){
      this.setState({
          max: this.state.max + 5
      });

  },

  _onReadMore(item, event){

    var current = this.state.expandedCommentId;
    current[item.id] = true;

    this.setState({
        expandedCommentId: current
    });

  },

  getCommentData() {
    superagent
      // XXX posts path
      .get(helper.topicURL(this.state.path.replace('/posts/', ''))
      .use(helper.withPromise())
      .end()
      .then(function (res) {
        this.setState({
          commentData: res.body.post_stream.posts
        })
      })
      .catch(function (err) {
        debug(err)
      })
  },

  // /////////////////// IMAGE URL ISSUE
{'fraction_non_alphanumeric': 0.16261682242990655, 'fraction_numerical': 0.0022429906542056075, 'mean_word_length': 2.1044083526682136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2253630', 'n_tokens_mistral': 839, 'n_tokens_neox': 815, 'n_words': 168}