<commit_before>import React from 'react';

import Messenger from '../components/components.messenger';
import BlockChat from './scopes.block-chat';
import { connect } from 'react-redux';
import actions from '../actions';
import config from '../config'


class Chat extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      showAttachment: false,
      messengerHeight: 50,
    };
  }

  render() {
    let chatOutputStyles = { height: `calc(100vh - ${ this.state.messengerHeight + 20 }px` };

    return (
      <section className="s-chat">
        <div className="s-chat__output" style={ chatOutputStyles }>
          <BlockChat/>
        </div>

        <div className="s-chat__input">
          <Messenger
            messengerHeight={ this.state.messengerHeight }
            keyUpInteraction={ this.keyUpInteraction.bind(this) }
            showAttachment={ this.state.showAttachment }
            toggleAttachment={ this.toggleAttachment.bind(this) }
          />
        </div>
      </section>
    );
  }

  keyUpInteraction(e) {
    let self = this;
    e.persist();

    setTimeout(function(){
      self.setState({
        messengerHeight: 50,
      });

      console.info('input scroll-height: ', e.target.scrollHeight);
      let scrollHeight = e.target.scrollHeight;

      self.setState({
        messengerHeight: scrollHeight,
      });
    }, 0);
  }

  toggleAttachment() {
    this.setState({
      showAttachment: !this.state.showAttachment
    });
  }

  componentDidMount() {
    this.props.updateLastSeen();
  }
}

const mapStateToProps = (state, ownProps) => state[config.stateName];

const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    updateLastSeen: () => dispatch(actions.chats.updateLastSeen(ownProps.chatId)),
  };
};

const ChatConnect = connect(mapStateToProps, mapDispatchToProps)(Chat);

export default ChatConnect;<commit_msg>Don't bother updating last seen timestamp when creating a new conversation.<commit_after>import React from 'react';

import Messenger from '../components/components.messenger';
import BlockChat from './scopes.block-chat';
import { connect } from 'react-redux';
import actions from '../actions';
import config from '../config'


class Chat extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      showAttachment: false,
      messengerHeight: 50,
    };
  }

  render() {
    let chatOutputStyles = { height: `calc(100vh - ${ this.state.messengerHeight + 20 }px` };

    return (
      <section className="s-chat">
        <div className="s-chat__output" style={ chatOutputStyles }>
          <BlockChat/>
        </div>

        <div className="s-chat__input">
          <Messenger
            messengerHeight={ this.state.messengerHeight }
            keyUpInteraction={ this.keyUpInteraction.bind(this) }
            showAttachment={ this.state.showAttachment }
            toggleAttachment={ this.toggleAttachment.bind(this) }
          />
        </div>
      </section>
    );
  }

  keyUpInteraction(e) {
    let self = this;
    e.persist();

    setTimeout(function(){
      self.setState({
        messengerHeight: 50,
      });

      console.info('input scroll-height: ', e.target.scrollHeight);
      let scrollHeight = e.target.scrollHeight;

      self.setState({
        messengerHeight: scrollHeight,
      });
    }, 0);
  }

  toggleAttachment() {
    this.setState({
      showAttachment: !this.state.showAttachment
    });
  }

  componentDidMount() {
    if ( !!this.props.chat ) {
      this.props.updateLastSeen();
    }
  }
}

const mapStateToProps = (state, ownProps) => state[config.stateName];

const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    updateLastSeen: () => dispatch(actions.chats.updateLastSeen(ownProps.chatId)),
  };
};

const ChatConnect = connect(mapStateToProps, mapDispatchToProps)(Chat);

export default ChatConnect;
{'fraction_non_alphanumeric': 0.1319073083778966, 'fraction_numerical': 0.005092946269416858, 'mean_word_length': 2.806201550387597, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, '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': '1527289', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1153, 'n_words': 229}