<commit_before>var React = require('react');
var PropTypes = React.PropTypes;

var {Input,Modal,Row,Alert,Button} = require('react-bootstrap');

var AUTH_FIELDS = {
  manage_exercises: 'Manage exercises',
  manage_authorizations: 'Manage user authorizations',
  manage_users: 'Manage users'
};

var _onChange = function(field, event) {
  var change = this.state.auth;
  change[field] = event.target.checked;
  this.setState({auth: change});
};

var EditUserAuthsModal = React.createClass({
  propTypes: {
    auth: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]).isRequired,
    doCancel: PropTypes.func.isRequired,
    doDismissError: PropTypes.func.isRequired,
    doSave: PropTypes.func.isRequired,
    error: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired
  },
  getInitialState: function() {
    return {auth: false};
  },
  componentWillReceiveProps: function(nextProps) {
    if(this.props.auth != nextProps.auth){
      var auth = {};
      Object.keys(AUTH_FIELDS).forEach((f) => auth[f] = nextProps.auth[f]);
      this.setState({user_id: nextProps.auth.user_id, auth: auth});
    }
  },
  render: function() {
    return (
      <Modal show={this.props.auth && true} onHide={this.props.doCancel}>
        <Modal.Header closeButton>
          <Modal.Title>Edit user authorizations</Modal.Title>
          {this.props.error && (
            <Row>
              <Alert bsStyle="danger" onDismiss={this.props.doDismissError}>{this.props.error}</Alert>
            </Row>
          )}
        </Modal.Header>
        <Modal.Body>
          <form>
            {Object.keys(AUTH_FIELDS).map((f) => (
              <Input key={f} label={AUTH_FIELDS[f]} type='checkbox' checked={this.state.auth[f]} onChange={_onChange.bind(this, f)} />
            ))}
          </form>
        </Modal.Body>
        <Modal.Footer>
          <Button onClick={this.props.doCancel}>Cancel</Button>
          <Button bsStyle='success' onClick={() => this.props.doSave(this.state.user_id, this.state.auth)}>Save</Button>
        </Modal.Footer>
      </Modal>
    );
  }
});

module.exports = EditUserAuthsModal;<commit_msg>Removed alert in edit user auths modal<commit_after>var React = require('react');
var PropTypes = React.PropTypes;

var {Input,Modal,Button} = require('react-bootstrap');

var AUTH_FIELDS = {
  manage_exercises: 'Manage exercises',
  manage_authorizations: 'Manage user authorizations',
  manage_users: 'Manage users'
};

var _onChange = function(field, event) {
  var change = this.state.auth;
  change[field] = event.target.checked;
  this.setState({auth: change});
};

var EditUserAuthsModal = React.createClass({
  propTypes: {
    auth: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]).isRequired,
    doCancel: PropTypes.func.isRequired,
    doDismissError: PropTypes.func.isRequired,
    doSave: PropTypes.func.isRequired
  },
  getInitialState: function() {
    return {auth: false};
  },
  componentWillReceiveProps: function(nextProps) {
    if(this.props.auth != nextProps.auth){
      var auth = {};
      Object.keys(AUTH_FIELDS).forEach((f) => auth[f] = nextProps.auth[f]);
      this.setState({user_id: nextProps.auth.user_id, auth: auth});
    }
  },
  render: function() {
    return (
      <Modal show={this.props.auth && true} onHide={this.props.doCancel}>
        <Modal.Header closeButton>
          <Modal.Title>Edit user authorizations</Modal.Title>
        </Modal.Header>
        <Modal.Body>
          <form>
            {Object.keys(AUTH_FIELDS).map((f) => (
              <Input key={f} label={AUTH_FIELDS[f]} type='checkbox' checked={this.state.auth[f]} onChange={_onChange.bind(this, f)} />
            ))}
          </form>
        </Modal.Body>
        <Modal.Footer>
          <Button onClick={this.props.doCancel}>Cancel</Button>
          <Button bsStyle='success' onClick={() => this.props.doSave(this.state.user_id, this.state.auth)}>Save</Button>
        </Modal.Footer>
      </Modal>
    );
  }
});

module.exports = EditUserAuthsModal;
{'fraction_non_alphanumeric': 0.15455450472872076, 'fraction_numerical': 0.0, 'mean_word_length': 3.1995820271682343, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 47, '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': '6953225', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1289, 'n_words': 214}