<commit_before># Root view for all the details of a notification
class app.Views.NotificationDetailsView extends Backbone.View
  el: '#details'

  keyboardEvents:
    'm': -> @model.subscription.toggle()
    'M': 'muteAndNext'
    's': -> @model.toggleStar()
    'o': 'open'
    'r': 'reply'

  events:
    'click a': 'clickLink'
    'click *[rel=back]': 'unfocus'

  # Required options:
  # model - a notification object
  initialize: ->
    view = app.Views.Subject.for(@model.subject)
    @subject = new view(model: @model.subject, notification: @model)
    @header = new app.Views.NotificationHeader(model: @model)
    @model.select()
    @render()

  render: ->
    @$el.empty()
    @$el.append @header.el
    @$el.append @subject.el
    @$el.addClass('focused')
    @

  # Set target=_blank if it is an external link
  clickLink: (e) ->
    href = e.target.getAttribute('href')
    e.target.target = '_blank' if href && href.hostname != window.location.hostname

  unfocus: (e) ->
    e.preventDefault()
    @$el.removeClass('focused')

  muteAndNext: ->
    @model.subscription.toggle()
    if notification = @model.collection.next()
      Backbone.history.navigate "#n/#{notification.id}", trigger: true

  # Go to the page on GitHub for this notification
  open: (e) ->
    window.open @model.subject.get('html_url'), '_blank'

  # Focus the reply textarea
  reply:(e) ->
    e.preventDefault()
    @$('textarea').focus()<commit_msg>Links directly to the comment<commit_after># Root view for all the details of a notification
class app.Views.NotificationDetailsView extends Backbone.View
  el: '#details'

  keyboardEvents:
    'm': -> @model.subscription.toggle()
    'M': 'muteAndNext'
    's': -> @model.toggleStar()
    'o': 'open'
    'r': 'reply'

  events:
    'click a': 'clickLink'
    'click *[rel=back]': 'unfocus'
    'click header h1 a': 'open'

  # Required options:
  # model - a notification object
  initialize: ->
    view = app.Views.Subject.for(@model.subject)
    @subject = new view(model: @model.subject, notification: @model)
    @header = new app.Views.NotificationHeader(model: @model)
    @model.select()
    @render()

  render: ->
    @$el.empty()
    @$el.append @header.el
    @$el.append @subject.el
    @$el.addClass('focused')
    @

  # Set target=_blank if it is an external link
  clickLink: (e) ->
    href = e.target.getAttribute('href')
    e.target.target = '_blank' if href && href.hostname != window.location.hostname

  unfocus: (e) ->
    e.preventDefault()
    @$el.removeClass('focused')

  muteAndNext: ->
    @model.subscription.toggle()
    if notification = @model.collection.next()
      Backbone.history.navigate "#n/#{notification.id}", trigger: true

  # Go to the page on GitHub for this notification
  open: (e) ->
    if unread = @model.subject.comments.detect((comment) -> comment.isUnread())
      window.open unread.get('html_url'), '_blank'
    else
      window.open @model.subject.get('html_url'), '_blank'

  # Focus the reply textarea
  reply:(e) ->
    e.preventDefault()
    @$('textarea').focus()
{'fraction_non_alphanumeric': 0.15810019518542615, 'fraction_numerical': 0.00032530904359141186, 'mean_word_length': 3.2531120331950207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '4810277', 'n_tokens_mistral': 1005, 'n_tokens_neox': 990, 'n_words': 244}