       .value()
 
 
-  messageInput: (e) ->
+  messageInput: (e) =>
     @setState message: e.target.value
 
 
-  submitIfEnter: (e) ->
+  submitIfEnter: (e) =>
     return if e.keyCode != 13
 
     e.preventDefault()
     @throttledUpdatePost()
 
 
-  updatePost: ->
+  updatePost: =>
     return if @state.message == @props.post.message
 
     LoadingOverlay.show()

        @messageEditor()


  addEditorLink: (message) ->
    _.chain message
      .escape()
      .replace /(^|\s)((\d{2}):(\d{2})[:.](\d{3})( \([\d,|]+\))?(?=\s))/g, (_, prefix, text, m, s, ms, range) =>


bn = 'beatmap-discussion-post'

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

    @throttledUpdatePost = _.throttle @updatePost, 1000
    @xhr = {}

    @state =
      editing: false
      message: @props.post.message


  componentDidMount: =>
    osu.pageChange()


  componentDidUpdate: =>
    osu.pageChange()


  componentWillUnmount: =>
    @throttledUpdatePost.cancel()

    for own _id, xhr of @xhr
      xhr?.abort()


  render: =>
    topClasses = "#{bn} #{bn}--#{@props.type}"
    if @state.editing
      topClasses += " #{bn}--editing"
