<commit_before>class SidebarArticleAttachments extends App.Controller
  sidebarItem: =>
    return if !@Config.get('ui_ticket_zoom_sidebar_article_attachments')
    @item = {
      name: 'attachment'
      badgeIcon: 'paperclip'
      sidebarHead: 'Attachments'
      sidebarCallback: @showObjects
      sidebarActions: []
    }
    @item

  showObjects: (el) =>
    @el = el

    if _.isEmpty(@ticket) || _.isEmpty(@ticket.article_ids)
      @el.html("<div>#{App.i18n.translateInline('none')}</div>")
      return
    html = ''
    for ticket_article_id in @ticket.article_ids.sort((a, b) -> a - b)
      if App.TicketArticle.exists(ticket_article_id)
        article = App.TicketArticle.find(ticket_article_id)
        attachments = App.TicketArticle.contentAttachments(article)
        if !_.isEmpty(attachments)
          html += App.view('ticket_zoom/sidebar_article_attachment')(article: article, attachments: attachments)
    @el.html(html)
    @el.delegate('.js-attachments img', 'click', (e) =>
      @imageView(e)
    )

  imageView: (e) ->
    e.preventDefault()
    e.stopPropagation()
    new App.TicketZoomArticleImageView(image: $(e.target).get(0).outerHTML)

App.Config.set('900-ArticleAttachments', SidebarArticleAttachments, 'TicketZoomSidebar')
<commit_msg>Followup #3584 - Fix order to DESC.<commit_after>class SidebarArticleAttachments extends App.Controller
  sidebarItem: =>
    return if !@Config.get('ui_ticket_zoom_sidebar_article_attachments')
    @item = {
      name: 'attachment'
      badgeIcon: 'paperclip'
      sidebarHead: 'Attachments'
      sidebarCallback: @showObjects
      sidebarActions: []
    }
    @item

  showObjects: (el) =>
    @el = el

    if _.isEmpty(@ticket) || _.isEmpty(@ticket.article_ids)
      @el.html("<div>#{App.i18n.translateInline('none')}</div>")
      return
    html = ''
    for ticket_article_id in @ticket.article_ids.sort((a, b) -> b - a)
      if App.TicketArticle.exists(ticket_article_id)
        article = App.TicketArticle.find(ticket_article_id)
        attachments = App.TicketArticle.contentAttachments(article)
        if !_.isEmpty(attachments)
          html += App.view('ticket_zoom/sidebar_article_attachment')(article: article, attachments: attachments)
    @el.html(html)
    @el.delegate('.js-attachments img', 'click', (e) =>
      @imageView(e)
    )

  imageView: (e) ->
    e.preventDefault()
    e.stopPropagation()
    new App.TicketZoomArticleImageView(image: $(e.target).get(0).outerHTML)

App.Config.set('900-ArticleAttachments', SidebarArticleAttachments, 'TicketZoomSidebar')

{'fraction_non_alphanumeric': 0.13558663558663558, 'fraction_numerical': 0.006216006216006216, 'mean_word_length': 3.6396396396396398, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4234259', 'n_tokens_mistral': 871, 'n_tokens_neox': 826, 'n_words': 135}