<commit_before>import React from 'react';
import {Link} from 'react-router';
import {connect} from 'react-redux';

import {userActions} from './select-utils';
import {getUserInfo} from '../redux/action-creators';
import throbber16 from 'assets/images/throbber-16.gif';

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

    this.state = {
      isDescriptionOpen: false
    };

    // Load this user's info if it's not in the store already
    if (!props.user.id && !props.user.errorMessage) {
      setTimeout(() => props.getUserInfo(props.username), 0);
    }
  }

  toggleDescription = () => {
    this.setState({isDescriptionOpen: !this.state.isDescriptionOpen});
  }

  unsubscribe = () => {
    if (this.props.amIGroupAdmin) {
      alert('You are the Admin for this group. If you want to unsubscribe please drop administrative privileges first.');
    } else {
      this.props.unsubscribe({username: this.props.user.username, id: this.props.user.id});
    }
  }

  render() {
    const props = this.props;

    return (
      props.user.errorMessage ? (
        <div className="user-card">
          <div className="user-card-info">
            <div className="userpic userpic-large userpic-error">
              <i className="fa fa-exclamation"></i>
            </div>
            <div className="username">@{props.user.username}</div>
            <div className="description">{props.user.errorMessage}</div>
          </div>
        </div>
      ) : !props.user.id ? (
        <div className="user-card">
          <div className="user-card-info">
            <div className="userpic userpic-large userpic-loading"></div>
            <div className="username">
              <img width="16" height="16" src={throbber16}/>
            </div>
          </div>
        </div>
      ) : (
        <div className="user-card">
          <div className="user-card-info">
            <Link to={`/${props.user.username}`} className="userpic userpic-large">
              <img src={props.user.profilePictureLargeUrl} width="75" height="75"/>
            </Link>

            <div className="display-name">
              <Link to={`/${props.user.username}`}>{props.user.screenName}</Link>
            </div>

            <div className="username">
              @{props.user.username}
              {props.user.description ? (
                <i className={'description-trigger fa ' + (this.state.isDescriptionOpen ? 'fa-chevron-up' : 'fa-chevron-down')}
                   onClick={this.toggleDescription}></i>
              ) : false}
            </div>

            {this.state.isDescriptionOpen ? (
              <div className="description">{props.user.description}</div>
            ) : false}

            {!props.isItMe ? (
              <div className="description">
                {props.user.isPrivate === '1' ? (
                  <span><i className="fa fa-lock"></i> Private</span>
                ) : (
                  <span><i className="fa fa-globe"></i> Public</span>
                )}
                {props.user.isRestricted === '1' ? ' restricted' : false}
                {props.user.type === 'user' ? ' feed' : ' group'}
              </div>
            ) : false}

            {props.isItMe ? (
              <div className="status">It's you!</div>
            ) : (
              <div className="status">
                {props.blocked ? (
                  <span><i className="fa fa-ban"></i> You've blocked the user</span>
                ) : props.hasRequestBeenSent ? (
                  <span><i className="fa fa-clock-o"></i> You've sent sub request</span>
                ) : props.amISubscribedToUser ? (
                  props.user.type === 'user' ? (
                    props.isUserSubscribedToMe ? (
                      <span><i className="fa fa-check-circle"></i> Mutually subscribed</span>
                    ) : (
                      <span><i className="fa fa-check-circle"></i> You are subscribed</span>
                    )
                  ) : props.amIGroupAdmin ? (
                    <span><i className="fa fa-check-square"></i> You are an admin</span>
                  ) : (
                    <span><i className="fa fa-check-square"></i> You are a member</span>
                  )
                ) : (
                  false
                )}
              </div>
            )}
          </div>

          {props.blocked ? (
            <div className="user-card-actions"><commit_msg>Add status "User subscribed to you" to UserCard<commit_after>import React from 'react';
import {Link} from 'react-router';
import {connect} from 'react-redux';

import {userActions} from './select-utils';
import {getUserInfo} from '../redux/action-creators';
import throbber16 from 'assets/images/throbber-16.gif';

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

    this.state = {
      isDescriptionOpen: false
    };

    // Load this user's info if it's not in the store already
    if (!props.user.id && !props.user.errorMessage) {
      setTimeout(() => props.getUserInfo(props.username), 0);
    }
  }

  toggleDescription = () => {
    this.setState({isDescriptionOpen: !this.state.isDescriptionOpen});
  }

  unsubscribe = () => {
    if (this.props.amIGroupAdmin) {
      alert('You are the Admin for this group. If you want to unsubscribe please drop administrative privileges first.');
    } else {
      this.props.unsubscribe({username: this.props.user.username, id: this.props.user.id});
    }
  }

  render() {
    const props = this.props;

    return (
      props.user.errorMessage ? (
        <div className="user-card">
          <div className="user-card-info">
            <div className="userpic userpic-large userpic-error">
              <i className="fa fa-exclamation"></i>
            </div>
            <div className="username">@{props.user.username}</div>
            <div className="description">{props.user.errorMessage}</div>
          </div>
        </div>
      ) : !props.user.id ? (
        <div className="user-card">
          <div className="user-card-info">
            <div className="userpic userpic-large userpic-loading"></div>
            <div className="username">
              <img width="16" height="16" src={throbber16}/>
            </div>
          </div>
        </div>
      ) : (
        <div className="user-card">
          <div className="user-card-info">
            <Link to={`/${props.user.username}`} className="userpic userpic-large">
              <img src={props.user.profilePictureLargeUrl} width="75" height="75"/>
            </Link>

            <div className="display-name">
              <Link to={`/${props.user.username}`}>{props.user.screenName}</Link>
            </div>

            <div className="username">
              @{props.user.username}
              {props.user.description ? (
                <i className={'description-trigger fa ' + (this.state.isDescriptionOpen ? 'fa-chevron-up' : 'fa-chevron-down')}
                   onClick={this.toggleDescription}></i>
              ) : false}
            </div>

            {this.state.isDescriptionOpen ? (
              <div className="description">{props.user.description}</div>
            ) : false}

            {!props.isItMe ? (
              <div className="description">
                {props.user.isPrivate === '1' ? (
                  <span><i className="fa fa-lock"></i> Private</span>
                ) : (
                  <span><i className="fa fa-globe"></i> Public</span>
                )}
                {props.user.isRestricted === '1' ? ' restricted' : false}
                {props.user.type === 'user' ? ' feed' : ' group'}
              </div>
            ) : false}

            {props.isItMe ? (
              <div className="status">It's you!</div>
            ) : (
              <div className="status">
                {props.blocked ? (
                  <span><i className="fa fa-ban"></i> You've blocked the user</span>
                ) : props.hasRequestBeenSent ? (
                  <span><i className="fa fa-clock-o"></i> You've sent sub request</span>
                ) : props.amISubscribedToUser ? (
                  props.user.type === 'user' ? (
                    props.isUserSubscribedToMe ? (
                      <span><i className="fa fa-check-circle"></i> Mutually subscribed</span>
                    ) : (
                      <span><i className="fa fa-check-circle"></i> You are subscribed</span>
                    )
                  ) : props.amIGroupAdmin ? (
                    <span><i className="fa fa-check-square"></i> You are an admin</span>
                  ) : (
                    <span><i className="fa fa-check-square"></i> You are a member</span>
                  )
                ) : props.isUserSubscribedToMe ? (
                  <span><i className="fa fa-check-circle-o"></i> User subscribed to you</span>
                ) : (
                  false
                )}
              </div>
            )}
          </div>

          {props.blocked ? (
            <div className="user-card-actions">
{'fraction_non_alphanumeric': 0.15208834463153292, 'fraction_numerical': 0.0037174721189591076, 'mean_word_length': 1.6982300884955752, 'pattern_counts': {'":': 0, '<': 159, '<?xml version=': 0, '>': 165, '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': '1853871', 'n_tokens_mistral': 2618, 'n_tokens_neox': 2507, 'n_words': 486}