<commit_before>kd           = require 'kd'
React        = require 'kd-react'
immutable    = require 'immutable'
classnames   = require 'classnames'
ActivityFlux = require 'activity/flux'
ChannelLabel = require 'activity/components/channellabel'
Button       = require 'app/components/common/button'

module.exports = class FeedThreadHeader extends React.Component

  @propTypes =
    className : React.PropTypes.string
    channel   : React.PropTypes.instanceOf immutable.Map()


  @defaultProps =
    className : ''
    channel   : immutable.Map()


  onClick: ->

    channelId     = @props.thread.getIn ['channel', 'id']
    isParticipant = @props.thread.getIn ['channel', 'isParticipant']

    if isParticipant
      ActivityFlux.actions.channel.unfollowChannel channelId
    else
      ActivityFlux.actions.channel.followChannel channelId


  getFollowButtonClassNames: -> classnames
    'FeedList-followButton'  : yes
    'following': @props.thread.getIn ['channel', 'isParticipant']


  render: ->

    return null  unless @props.channel

    <div className={kd.utils.curry "ThreadHeader", @props.className}>
      <ChannelLabel channel={@props.channel} />
      <Button
        className={@getFollowButtonClassNames()}}
        onClick={@bound 'onClick'}>
      </Button>
    </div><commit_msg>Clint: Activity: Using channel props instead of thread<commit_after>kd           = require 'kd'
React        = require 'kd-react'
immutable    = require 'immutable'
classnames   = require 'classnames'
ActivityFlux = require 'activity/flux'
ChannelLabel = require 'activity/components/channellabel'
Button       = require 'app/components/common/button'

module.exports = class FeedThreadHeader extends React.Component

  @propTypes =
    className : React.PropTypes.string
    channel   : React.PropTypes.instanceOf immutable.Map()


  @defaultProps =
    className : ''
    channel   : immutable.Map()


  onClick: ->

    channelId     = @props.channel.get 'id'
    isParticipant = @props.channel.get 'isParticipant'

    if isParticipant
      ActivityFlux.actions.channel.unfollowChannel channelId
    else
      ActivityFlux.actions.channel.followChannel channelId


  getFollowButtonClassNames: -> classnames
    'FeedList-followButton' : yes
    'following'             : @props.channel.get 'isParticipant'


  render: ->

    return null  unless @props.channel

    <div className={kd.utils.curry "ThreadHeader", @props.className}>
      <ChannelLabel channel={@props.channel} />
      <Button
        className={@getFollowButtonClassNames()}}
        onClick={@bound 'onClick'}>
      </Button>
    </div>
{'fraction_non_alphanumeric': 0.11051625239005736, 'fraction_numerical': 0.0, 'mean_word_length': 3.281505728314239, 'pattern_counts': {'":': 0, '<': 13, '<?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': '5937173', 'n_tokens_mistral': 777, 'n_tokens_neox': 746, 'n_words': 157}