<commit_before>React = require 'react'
PrivateMessageForm = require '../../talk/private-message-form'
talkClient = require '../../api/talk'
PromiseRenderer = require '../../components/promise-renderer'

module.exports = React.createClass
  displayName: 'PrivateMessagePage'

  getInitialState: ->
    block: null

  componentDidMount: ->
    userId = @props.profileUser?.id
    @getBlockedUser(userId) if userId

  componentWillReceiveProps: (nextProps) ->
    userId = nextProps.profileUser?.id
    @getBlockedUser(userId) if userId and userId isnt @props.profileUser?.id

  getBlockedUser: (id) ->
    talkClient.type('blocked_users').get(blocked_user_id: id).then ([block]) =>
      @setState {block}

  handleBlock: (e) ->
    talkClient.type('blocked_users').create(blocked_user_id: @props.profileUser.id).save().then (block) =><commit_msg>Remove unnecessary require<commit_after>React = require 'react'
PrivateMessageForm = require '../../talk/private-message-form'
talkClient = require '../../api/talk'

module.exports = React.createClass
  displayName: 'PrivateMessagePage'

  getInitialState: ->
    block: null

  componentDidMount: ->
    userId = @props.profileUser?.id
    @getBlockedUser(userId) if userId

  componentWillReceiveProps: (nextProps) ->
    userId = nextProps.profileUser?.id
    @getBlockedUser(userId) if userId and userId isnt @props.profileUser?.id

  getBlockedUser: (id) ->
    talkClient.type('blocked_users').get(blocked_user_id: id).then ([block]) =>
      @setState {block}

  handleBlock: (e) ->
    talkClient.type('blocked_users').create(blocked_user_id: @props.profileUser.id).save().then (block) =>
{'fraction_non_alphanumeric': 0.14564290067032298, 'fraction_numerical': 0.0, 'mean_word_length': 4.313915857605178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2962594', 'n_tokens_mistral': 506, 'n_tokens_neox': 515, 'n_words': 95}