<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import StatusContainer from '../../../containers/status_container';

export default class Conversation extends ImmutablePureComponent {

  static contextTypes = {
    router: PropTypes.object,
  };

  static propTypes = {
    conversationId: PropTypes.string.isRequired,
    accounts: ImmutablePropTypes.list.isRequired,
    lastStatusId: PropTypes.string,
    unread:PropTypes.bool.isRequired,
    onMoveUp: PropTypes.func,
    onMoveDown: PropTypes.func,
    markRead: PropTypes.func.isRequired,
  };

  handleClick = () => {
    if (!this.context.router) {
      return;
    }

    const { lastStatusId, unread, markRead } = this.props;

    if (unread) {
      markRead();
    }

    this.context.router.history.push(`/statuses/${lastStatusId}`);
  }

  handleHotkeyMoveUp = () => {
    this.props.onMoveUp(this.props.conversationId);
  }

  handleHotkeyMoveDown = () => {
    this.props.onMoveDown(this.props.conversationId);
  }

  render () {
    const { accounts, lastStatusId, unread } = this.props;

    if (lastStatusId === null) {
      return null;
    }

    return (
      <StatusContainer
        id={lastStatusId}
        unread={unread}
        otherAccounts={accounts}
        onMoveUp={this.handleHotkeyMoveUp}
        onMoveDown={this.handleHotkeyMoveDown}
      />
    );
  }

}<commit_msg>Fix conversations not being marked read on click (#9103)<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import StatusContainer from '../../../containers/status_container';

export default class Conversation extends ImmutablePureComponent {

  static contextTypes = {
    router: PropTypes.object,
  };

  static propTypes = {
    conversationId: PropTypes.string.isRequired,
    accounts: ImmutablePropTypes.list.isRequired,
    lastStatusId: PropTypes.string,
    unread:PropTypes.bool.isRequired,
    onMoveUp: PropTypes.func,
    onMoveDown: PropTypes.func,
    markRead: PropTypes.func.isRequired,
  };

  handleClick = () => {
    if (!this.context.router) {
      return;
    }

    const { lastStatusId, unread, markRead } = this.props;

    if (unread) {
      markRead();
    }

    this.context.router.history.push(`/statuses/${lastStatusId}`);
  }

  handleHotkeyMoveUp = () => {
    this.props.onMoveUp(this.props.conversationId);
  }

  handleHotkeyMoveDown = () => {
    this.props.onMoveDown(this.props.conversationId);
  }

  render () {
    const { accounts, lastStatusId, unread } = this.props;

    if (lastStatusId === null) {
      return null;
    }

    return (
      <StatusContainer
        id={lastStatusId}
        unread={unread}
        otherAccounts={accounts}
        onMoveUp={this.handleHotkeyMoveUp}
        onMoveDown={this.handleHotkeyMoveDown}
        onClick={this.handleClick}
      />
    );
  }

}
{'fraction_non_alphanumeric': 0.12098844672657252, 'fraction_numerical': 0.0012836970474967907, 'mean_word_length': 3.2064777327935223, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '4825994', 'n_tokens_mistral': 968, 'n_tokens_neox': 969, 'n_words': 169}