<commit_before>if Backbone?
  class @ResponseCommentShowView extends DiscussionContentView

    events:
      "click .discussion-flag-abuse": "toggleFlagAbuse"
      "click .action-edit": "edit"
      "click .action-delete": "_delete"

    tagName: "li"

    initialize: ->
        super()
        @model.on "change", @updateModelDetails

    render: ->
      @template = _.template($("#response-comment-show-template").html())
      params = @model.toJSON()

      @$el.html(@template(params))
      @initLocal()
      @delegateEvents()
      @renderAttrs()
      @renderFlagged()
      #@markAsStaff()
      @$el.find(".timeago").timeago()
      @$el.find('a.profile-link').attr('href','javascript:void(0);')
      @$el.find('a.profile-link').css('cursor','default')
      @$el.find('a.profile-link').css('color','#366094')
      @convertMath()
      @addReplyLink()
      @

    addReplyLink: () ->
      if @model.hasOwnProperty('parent')
        name = @model.parent.get('username') ? "anonymous"
        html = "<a href='#comment_#{@model.parent.id}'>@#{name}</a>:  "
        p = @$('.response-body p:first')
        p.prepend(html)

    convertMath: ->
      body = @$el.find(".response-body")
      body.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight body.text()
      MathJax.Hub.Queue ["Typeset", MathJax.Hub, body[0]]

    markAsStaff: ->
      if DiscussionUtil.isStaff(@model.get("user_id"))
        @$el.find("a.profile-link").after('<span class="staff-label">staff</span>')
      else if DiscussionUtil.isTA(@model.get("user_id"))
        @$el.find("a.profile-link").after('<span class="community-ta-label">Community&nbsp;&nbsp;TA</span>')


    renderFlagged: =>
      if window.user.id in @model.get("abuse_flaggers") or (DiscussionUtil.isFlagModerator and @model.get("abuse_flaggers").length > 0)
        @$("[data-role=thread-flag]").addClass("flagged")
        @$("[data-role=thread-flag]").removeClass("notflagged")
      else
        @$("[data-role=thread-flag]").removeClass("flagged")
        @$("[data-role=thread-flag]").addClass("notflagged")

    updateModelDetails: =>
      @renderFlagged()

    hideCommentForm: () ->
      @$('.comment-form').closest('li').hide()

    showCommentForm: () ->
      @$('.comment-form').closest('li').show()
      
    renderSubView: (view) ->
      view.setElement(@$('.discussion-response'+@model.id))
      view.render()
      view.delegateEvents()

    renderShowView: () ->
      @renderSubView(@showView)

    createShowView: () ->

      if @editView?
        @editView.undelegateEvents()
        @editView.$el.empty()
        @editView = null

      @showView = new ThreadResponseShowView(model: @model)
      @showView.bind "response:_delete", @_delete
      @showView.bind "response:edit", @edit

    edit: (event) =>
      @createEditView()
      @renderEditView()
      @hideCommentForm()

    _delete: (event) =>
      event.preventDefault()
      if not @model.get('can_delete')
        return<commit_msg>Increase discussion comment delete<commit_after>if Backbone?
  class @ResponseCommentShowView extends DiscussionContentView

    events:
      "click .discussion-flag-abuse": "toggleFlagAbuse"
      "click .action-edit": "edit"
      "click .action-delete": "_delete"

    tagName: "li"

    initialize: ->
        super()
        @model.on "change", @updateModelDetails

    render: ->
      @template = _.template($("#response-comment-show-template").html())
      params = @model.toJSON()

      @$el.html(@template(params))
      @initLocal()
      @delegateEvents()
      @renderAttrs()
      @renderFlagged()
      #@markAsStaff()
      @$el.find(".timeago").timeago()
      @$el.find('a.profile-link').attr('href','javascript:void(0);')
      @$el.find('a.profile-link').css('cursor','default')
      @$el.find('a.profile-link').css('color','#366094')
      @convertMath()
      @addReplyLink()
      @

    addReplyLink: () ->
      if @model.hasOwnProperty('parent')
        name = @model.parent.get('username') ? "anonymous"
        html = "<a href='#comment_#{@model.parent.id}'>@#{name}</a>:  "
        p = @$('.response-body p:first')
        p.prepend(html)

    convertMath: ->
      body = @$el.find(".response-body")
      body.html DiscussionUtil.postMathJaxProcessor DiscussionUtil.markdownWithHighlight body.text()
      MathJax.Hub.Queue ["Typeset", MathJax.Hub, body[0]]

    markAsStaff: ->
      if DiscussionUtil.isStaff(@model.get("user_id"))
        @$el.find("a.profile-link").after('<span class="staff-label">staff</span>')
      else if DiscussionUtil.isTA(@model.get("user_id"))
        @$el.find("a.profile-link").after('<span class="community-ta-label">Community&nbsp;&nbsp;TA</span>')


    renderFlagged: =>
      if window.user.id in @model.get("abuse_flaggers") or (DiscussionUtil.isFlagModerator and @model.get("abuse_flaggers").length > 0)
        @$("[data-role=thread-flag]").addClass("flagged")
        @$("[data-role=thread-flag]").removeClass("notflagged")
      else
        @$("[data-role=thread-flag]").removeClass("flagged")
        @$("[data-role=thread-flag]").addClass("notflagged")

    updateModelDetails: =>
      @renderFlagged()

    hideCommentForm: () ->
      @$('.comment-form').closest('li').hide()

    showCommentForm: () ->
      @$('.comment-form').closest('li').show()
      
    renderSubView: (view) ->
      view.setElement(@$('.discussion-response'+@model.id))
      view.render()
      view.delegateEvents()

    renderShowView: () ->
      @renderSubView(@showView)

    createShowView: () ->

      if @editView?
        @editView.undelegateEvents()
        @editView.$el.empty()
        @editView = null

      @showView = new ThreadResponseShowView(model: @model)
      @showView.bind "response:_delete", @_delete
      @showView.bind "response:edit", @edit

    edit: (event) =>
      @createEditView()
      @renderEditView()
      @hideCommentForm()

    _delete: (event) =>
      event.preventDefault()
      if not @model.can('can_delete')
        return
{'fraction_non_alphanumeric': 0.18521580949231023, 'fraction_numerical': 0.0029766826525549858, 'mean_word_length': 3.026631158455393, 'pattern_counts': {'":': 6, '<': 15, '<?xml version=': 0, '>': 45, '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': '5938452', 'n_tokens_mistral': 1972, 'n_tokens_neox': 1910, 'n_words': 264}