<commit_before>module WritableHelper
  def unread_warning
    return unless @replies.present?
    return if @replies.total_pages == page
    'You are not on the latest page of the thread ' + \
    tag.a('(View unread)', href: unread_path(@post), class: 'unread-warning') + ' ' + \
    tag.a('(New tab)', href: unread_path(@post), class: 'unread-warning', target: '_blank')
  end

  def post_or_reply_link(reply)
    return unless reply.id.present?
    post_or_reply_mem_link(id: reply.id, klass: reply.class)
  end

  def post_or_reply_mem_link(id: nil, klass: nil)
    return if id.nil?
    if klass == Reply
      reply_path(id, anchor: "reply-#{id}")
    else
      post_path(id)
    end
  end

  def has_edit_audits?(audits, written)
    return false unless written.id.present?
    if written.is_a?(Post)
      count = audits[:post]
    else
      count = audits.fetch(written.id, 0)
    end
    count > 1<commit_msg>Fix crash in post#delete_history by defaulting count to 0 harder in has_edit_audits?<commit_after>module WritableHelper
  def unread_warning
    return unless @replies.present?
    return if @replies.total_pages == page
    'You are not on the latest page of the thread ' + \
    tag.a('(View unread)', href: unread_path(@post), class: 'unread-warning') + ' ' + \
    tag.a('(New tab)', href: unread_path(@post), class: 'unread-warning', target: '_blank')
  end

  def post_or_reply_link(reply)
    return unless reply.id.present?
    post_or_reply_mem_link(id: reply.id, klass: reply.class)
  end

  def post_or_reply_mem_link(id: nil, klass: nil)
    return if id.nil?
    if klass == Reply
      reply_path(id, anchor: "reply-#{id}")
    else
      post_path(id)
    end
  end

  def has_edit_audits?(audits, written)
    return false unless written.id.present?
    if written.is_a?(Post)
      count = audits.fetch(:post, 0)
    else
      count = audits.fetch(written.id, 0)
    end
    count > 1
{'fraction_non_alphanumeric': 0.1186264308012487, 'fraction_numerical': 0.003121748178980229, 'mean_word_length': 3.2733333333333334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7124597', 'n_tokens_mistral': 673, 'n_tokens_neox': 676, 'n_words': 175}