     @setState collapsed: newState
 
 
-  setHighlight: (_e, {id}) ->
+  setHighlight: (_e, {id}) =>
     newState = id == @props.discussion.id
 
     return if @state.highlighted == newState

        div className: lineClasses


  displayVote: (type) ->
    vbn = 'beatmap-discussion-vote'

    [baseScore, icon] = switch type


bn = 'beatmap-discussion'

class BeatmapDiscussions.Discussion extends React.PureComponent
  constructor: (props) ->
    super props

    @eventId = "beatmap-discussion-entry-#{@props.discussion.id}"

    @state =
      collapsed: false
      highlighted: false


  componentWillMount: =>
    $.subscribe "beatmapDiscussionEntry:collapse.#{@eventId}", @setCollapse
    $.subscribe "beatmapDiscussionEntry:highlight.#{@eventId}", @setHighlight


  componentWillUnmount: =>
    $.unsubscribe ".#{@eventId}"
    @voteXhr?.abort()


  render: =>
    return div() if @props.discussion.beatmap_discussion_posts.length == 0

    topClasses = "#{bn} js-beatmap-discussion-jump"
