1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.PleromaAPI.ReportView do
9 alias Pleroma.Web.AdminAPI.Report
10 alias Pleroma.Web.CommonAPI.Utils
11 alias Pleroma.Web.MastodonAPI.AccountView
12 alias Pleroma.Web.MastodonAPI.StatusView
14 def render("index.json", %{reports: reports, for: for_user}) do
18 |> Enum.map(&Report.extract_report_info/1)
19 |> Enum.map(&render(__MODULE__, "show.json", Map.put(&1, :for, for_user))),
20 total: reports[:total]
24 def render("show.json", %{
31 created_at = Utils.to_masto_date(report.data["published"])
34 unless is_nil(report.data["content"]) do
35 HTML.filter_tags(report.data["content"])
42 account: AccountView.render("show.json", %{user: account, for: for_user}),
43 actor: AccountView.render("show.json", %{user: actor, for: for_user}),
45 created_at: created_at,
47 StatusView.render("index.json", %{
52 state: report.data["state"]