<commit_before>import React from "react";
import Modal from "react-bootstrap/lib/Modal";
var PureRenderMixin = require('react/addons').addons.PureRenderMixin;

var LinkWithConfirmation = React.createClass({
  mixins: [PureRenderMixin],

  propTypes: {
    disabled: React.PropTypes.bool,
    message: React.PropTypes.string.isRequired,
    onConfirm: React.PropTypes.func.isRequired
  },

  getInitialState() {
    return {
      isModalOpen: false
    };
  },

  onConfirm() {
    this.setState({
      isModalOpen: false
    });

    this.props.onConfirm();
  },

  onToggle() {
    if (this.props.disabled) {
      return;
    }
    this.setState({
      isModalOpen: !this.state.isModalOpen
    });
  },

  render() {
    var className = this.props.className;
    if (this.props.disabled) {
      className += ' disabled';
    }
    return (
      <div>
        <a className={className} disabled={this.props.disabled} onClick={this.onToggle} title={this.props.title}>
          {this.props.children}
        </a>

        <Modal show={this.state.isModalOpen} title="Please confirm" animation={false} onHide={this.onToggle}>
          <div className="modal-body">
            <p><strong>{this.props.message}</strong></p>
          </div>
          <div className="modal-footer">
            <button type="button" className="btn btn-default"
                    onClick={this.onToggle}>Cancel</button>
            <button type="button" className="btn btn-primary"
                    onClick={this.onConfirm}>Confirm</button>
          </div>
        </Modal>
      </div>
    );
  }
});

export default LinkWithConfirmation;
<commit_msg>Fix broken comment actions (closes GH-2174)<commit_after>import React from "react";
import Modal from "react-bootstrap/lib/Modal";
var PureRenderMixin = require('react/addons').addons.PureRenderMixin;

var LinkWithConfirmation = React.createClass({
  mixins: [PureRenderMixin],

  propTypes: {
    disabled: React.PropTypes.bool,
    message: React.PropTypes.string.isRequired,
    onConfirm: React.PropTypes.func.isRequired
  },

  getInitialState() {
    return {
      isModalOpen: false
    };
  },

  onConfirm() {
    this.setState({
      isModalOpen: false
    });

    this.props.onConfirm();
  },

  onToggle() {
    if (this.props.disabled) {
      return;
    }
    this.setState({
      isModalOpen: !this.state.isModalOpen
    });
  },

  render() {
    var className = this.props.className;
    if (this.props.disabled) {
      className += ' disabled';
    }
    return (
      <a className={className} disabled={this.props.disabled} onClick={this.onToggle} title={this.props.title}>
        {this.props.children}
        <Modal show={this.state.isModalOpen} title="Please confirm" animation={false} onHide={this.onToggle}>
          <div className="modal-body">
            <p><strong>{this.props.message}</strong></p>
          </div>
          <div className="modal-footer">
            <button type="button" className="btn btn-default"
                    onClick={this.onToggle}>Cancel</button>
            <button type="button" className="btn btn-primary"
                    onClick={this.onConfirm}>Confirm</button>
          </div>
        </Modal>
      </a>
    );
  }
});

export default LinkWithConfirmation;
{'fraction_non_alphanumeric': 0.14281354897772353, 'fraction_numerical': 0.0012206286237412267, 'mean_word_length': 2.6021978021978023, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '7249410', 'n_tokens_mistral': 993, 'n_tokens_neox': 977, 'n_words': 171}