                   onClick: @throttledPost
 
 
-  canUpdate: ->
+  canUpdate: =>
     return false if !@props.currentUser.id?
 
     @props.currentUser.isAdmin ||

    .always LoadingOverlay.hide


  setMessage: (e) ->
    @setState message: e.target.value


  submitIfEnter: (e) ->
    return if e.keyCode != 13

    e.preventDefault()
    @throttledPost()


  toggleResolveDiscussion: (e) ->
    @setState resolveDiscussion: e.target.checked


  validPost: ->
    @state.message.length != 0


bn = 'beatmap-discussion-post'

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

    @throttledPost = _.throttle @post, 1000

    @state =
      message: ''
      resolveDiscussion: @props.discussion.resolved


  componentWillUnmount: =>
    @throttledPost.cancel()
    @postXhr?.abort()


  render: =>
    div
      className: "#{bn} #{bn}--reply #{bn}--new-reply"

