<commit_before>Cloudsdale.MessageView = Ember.View.extend
  classNames:    ['message']
  classNameBindings: ['isLastMessage', 'isFirstMessage']

  templateName:  'message'

  shouldScrollToMessage: false

  willInsertElement: () ->
    # if @get('parentView').state == "inDOM"
    #   distance = @get('parentView.desiredScroll')
    #   @get('parentView').scrollToFromBottom(distance) if distance
    #   @set('shouldScrollToMessage', !@get('parentView').isReadingHistory())

    @_super()

  didInsertElement: ->
    # @get('parentView').scrollToBottom( force: @get('shouldScrollToMessage') ) if @get('parentView')
    # setTimeout =>
    #   @get('parentView').scrollToBottom( force: @get('shouldScrollToMessage') ) if @get('parentView')
    #   @set('shouldScrollToMessage', false)
    # , 100

    # if @get('context').get('hasSameAuthorAsPrevious')
    #   @.$().prevAll('.message').first().removeClass('message-last')

    # if @get('context').get('hasSameAuthorAsNext')
    #   @.$().nextAll('.message').first().removeClass('message-first')

    @.$('a[internal]').on('click', (e) =>
      event.preventDefault()
      @get('container')
      .lookup('router:main')
      .transitionTo(event.target.pathname)
      return false
    )

    @_super()

  willDestroyElement: ->
    @.$('a[internal]').off('click')
    @_super()

  isLastMessage: ( () ->
    if not @get('context').get('hasSameAuthorAsNext') then "message-last" else ""
  ).property('messagePositions')

  isFirstMessage: ( () ->
    if not @get('context').get('hasSameAuthorAsPrevious') then "message-first" else ""
  ).property('messagePositions')<commit_msg>Revert that.<commit_after>Cloudsdale.MessageView = Ember.View.extend
  classNames:    ['message']
  classNameBindings: ['isLastMessage', 'isFirstMessage']

  templateName:  'message'

  shouldScrollToMessage: false

  willInsertElement: () ->
    if @get('parentView').state == "inDOM"
      distance = @get('parentView.desiredScroll')
      @get('parentView').scrollToFromBottom(distance) if distance
      @set('shouldScrollToMessage', !@get('parentView').isReadingHistory())

    @_super()

  didInsertElement: ->
    @get('parentView').scrollToBottom( force: @get('shouldScrollToMessage') ) if @get('parentView')
    setTimeout =>
      @get('parentView').scrollToBottom( force: @get('shouldScrollToMessage') ) if @get('parentView')
      @set('shouldScrollToMessage', false)
    , 100

    if @get('context').get('hasSameAuthorAsPrevious')
      @.$().prevAll('.message').first().removeClass('message-last')

    if @get('context').get('hasSameAuthorAsNext')
      @.$().nextAll('.message').first().removeClass('message-first')

    @.$('a[internal]').on('click', (e) =>
      event.preventDefault()
      @get('container')
      .lookup('router:main')
      .transitionTo(event.target.pathname)
      return false
    )

    @_super()

  willDestroyElement: ->
    @.$('a[internal]').off('click')
    @_super()

  isLastMessage: ( () ->
    if not @get('context').get('hasSameAuthorAsNext') then "message-last" else ""
  ).property('messagePositions')

  isFirstMessage: ( () ->
    if not @get('context').get('hasSameAuthorAsPrevious') then "message-first" else ""
  ).property('messagePositions')
{'fraction_non_alphanumeric': 0.18794435857805256, 'fraction_numerical': 0.0018547140649149924, 'mean_word_length': 4.236245954692556, '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': '3310989', 'n_tokens_mistral': 1012, 'n_tokens_neox': 987, 'n_words': 144}