<commit_before>import React, { Component, PropTypes }  from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';

import {sendMessageAsync, storeTemporaryMessage} from '../../actions/chatActions';

class MessagesInput extends Component {

  constructor(props) {
    super(props);
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(event) {
    this.props.storeTemporaryMessage(event.target.value);
  }

  handleSubmit(event) {
    event.preventDefault();
    if (this.props.temporaryMessage) {
      this.props.sendMessage({
        content: this.props.temporaryMessage,
        date: new Date().getTime(),
        user: 'flo'
      });
    }
  }

  render() {
    return (
      <div>
        {
          this.props.loading && <p>Loading</p>
        }
        <form onSubmit={this.handleSubmit}>
          <textarea
            value={this.props.temporaryMessage}
            onChange={this.handleChange}
            placeholder="Type a message"
            id="textarea"
          />
          <input type="submit" value="Submit" />
        </form>
      </div>
    );
  }
}

MessagesInput.propTypes =  {
  loading: PropTypes.bool,
  temporaryMessage: PropTypes.string,
  sendMessage: PropTypes.func.isRequired,
  storeTemporaryMessage: PropTypes.func.isRequired
};

function mapStateToProps(state, ownProps) {
  return {
    loading: state.chat.loading,
    temporaryMessage: state.chat.temporaryMessage
  };
}

function mapDispatchToProps(dispatch) {
  return {
    sendMessage: bindActionCreators(sendMessageAsync, dispatch),
    storeTemporaryMessage: bindActionCreators(storeTemporaryMessage, dispatch)
  };
}

export default connect(mapStateToProps, mapDispatchToProps)(MessagesInput);<commit_msg>store user id in message object<commit_after>import React, { Component, PropTypes }  from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';

import {sendMessageAsync, storeTemporaryMessage} from '../../actions/chatActions';

class MessagesInput extends Component {

  constructor(props) {
    super(props);
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(event) {
    this.props.storeTemporaryMessage(event.target.value);
  }

  handleSubmit(event) {
    event.preventDefault();
    if (this.props.temporaryMessage) {
      this.props.sendMessage({
        content: this.props.temporaryMessage,
        date: new Date().getTime(),
        user: this.props.currentUserUID
      });
    }
  }

  render() {
    return (
      <div>
        {
          this.props.loading && <p>Loading</p>
        }
        <form onSubmit={this.handleSubmit}>
          <textarea
            value={this.props.temporaryMessage}
            onChange={this.handleChange}
            placeholder="Type a message"
            id="textarea"
          />
          <input type="submit" value="Submit" />
        </form>
      </div>
    );
  }
}

MessagesInput.propTypes =  {
  loading: PropTypes.bool,
  temporaryMessage: PropTypes.string,
  currentUserUID: PropTypes.string,
  sendMessage: PropTypes.func.isRequired,
  storeTemporaryMessage: PropTypes.func.isRequired
};

function mapStateToProps(state, ownProps) {
  return {
    loading: state.chat.loading,
    temporaryMessage: state.chat.temporaryMessage,
    currentUserUID: state.auth.currentUserUID
  };
}

function mapDispatchToProps(dispatch) {
  return {
    sendMessage: bindActionCreators(sendMessageAsync, dispatch),
    storeTemporaryMessage: bindActionCreators(storeTemporaryMessage, dispatch)
  };
}

export default connect(mapStateToProps, mapDispatchToProps)(MessagesInput);
{'fraction_non_alphanumeric': 0.11744340878828229, 'fraction_numerical': 0.0, 'mean_word_length': 3.1872909698996654, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '957793', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1090, 'n_words': 192}