report_helper.rb 694 Bytes
Newer Older
1 2
# frozen_string_literal: true

3 4 5 6 7
#   Copyright (c) 2012, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

module ReportHelper
8 9 10
  def report_content(report)
    case (item = report.item)
    when Post
11
      raw t("report.post_label", content: link_to(post_message(item), post_path(item.id)))
12
    when Comment
13
      raw t("report.comment_label", data: link_to(
14
        h(comment_message(item)),
15
        post_path(item.post.id, anchor: item.guid)
16
      ))
17
    else
18
      t("report.not_found")
19 20
    end
  end
21 22 23 24

  def unreviewed_reports_count
    @unreviewed_reports_count ||= Report.where(reviewed: false).size
  end
25
end