<commit_before>class DiscussionActivityItemView extends ActivityItemChild

  constructor:(options, data)->

    # in case of Discussions, the comments can go beyond one level. we need another view for that
    options = $.extend
      cssClass    : "activity-item discussion"
      tooltip     :
        title     : "Discussion"
        offset    : 3
        selector  : "span.type-icon"
    ,options

    super options,data

    @actionLinks = new DiscussionActivityActionsView
      delegate : @commentBox.opinionList
      cssClass : "reply-header"
    , data

    @commentBox.destroy()

    if data.repliesCount > 0
      @opinionBox = new DiscussionActivityOpinionView
        cssClass : "activity-opinion-list comment-container"
      , data
    else
      @opinionBox = new KDCustomHTMLView
        tagName:"div"
        cssClass:"opinion-first-box"

      @opinionBox.addSubView @opinionFirstLink = new KDCustomHTMLView
        tagName:"a"
        cssClass:"first-reply-link"
        attributes:
          title:"Be the first to reply"
          href:"#"
        partial:"Be the first to reply!"
        click:->
          appManager.tell "Activity", "createContentDisplay", data

  viewAppended:()->
    return if @getData().constructor is bongo.api.CDiscussionActivity
    super()
    @setTemplate @pistachio()
    @template.update()
    @$("pre").addClass "prettyprint"
    prettyPrint()


  click:(event)->
    if $(event.target).is("[data-paths~=title]")
      appManager.tell "Activity", "createContentDisplay", @getData()

  applyTextExpansions:(str = "")->

    str = @utils.applyTextExpansions str

    # FIXME: 500 chars is a naive separation, check if it is in a tag (<a> etc) and
    # make the separation after or before the tag in plain text.<commit_msg>fixed syntax highlighting when editing the activity, click interception, css vulnerability<commit_after>class DiscussionActivityItemView extends ActivityItemChild

  constructor:(options, data)->

    # in case of Discussions, the comments can go beyond one level. we need another view for that
    options = $.extend
      cssClass    : "activity-item discussion"
      tooltip     :
        title     : "Discussion"
        offset    : 3
        selector  : "span.type-icon"
    ,options

    super options,data

    @actionLinks = new DiscussionActivityActionsView
      delegate : @commentBox.opinionList
      cssClass : "reply-header"
    , data

    @commentBox.destroy()

    if data.repliesCount > 0
      @opinionBox = new DiscussionActivityOpinionView
        cssClass : "activity-opinion-list comment-container"
      , data
    else
      @opinionBox = new KDCustomHTMLView
        tagName:"div"
        cssClass:"opinion-first-box"

      @opinionBox.addSubView @opinionFirstLink = new KDCustomHTMLView
        tagName:"a"
        cssClass:"first-reply-link"
        attributes:
          title:"Be the first to reply"
          href:"#"
        partial:"Be the first to reply!"
        click:->
          appManager.tell "Activity", "createContentDisplay", data

  viewAppended:()->
    return if @getData().constructor is bongo.api.CDiscussionActivity
    super()
    @setTemplate @pistachio()
    @template.update()
    @$("pre").addClass "prettyprint"
    prettyPrint()

  render:->
    super()
    @$("pre").addClass "prettyprint"
    prettyPrint()

  click:(event)->
    if $(event.target).closest("[data-paths~=title], [data-paths~=body]")
      appManager.tell "Activity", "createContentDisplay", @getData()

  applyTextExpansions:(str = "")->
    str = @utils.expandUsernames @utils.applyMarkdown str

    # FIXME: 500 chars is a naive separation, check if it is in a tag (<a> etc) and
    # make the separation after or before the tag in plain text.
{'fraction_non_alphanumeric': 0.10349426513736996, 'fraction_numerical': 0.002667377967457989, 'mean_word_length': 2.7917087967644085, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '987494', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1023, 'n_words': 292}