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.AdminAPI.Report do
10 def extract_report_info(
11 %{data: %{"actor" => actor, "object" => [account_ap_id | status_ap_ids]}} = report
13 user = User.get_cached_by_ap_id(actor)
14 account = User.get_cached_by_ap_id(account_ap_id)
18 |> Enum.reject(&is_nil(&1))
20 act when is_map(act) ->
21 Activity.get_create_by_object_ap_id_with_object(act["id"]) ||
22 Activity.get_by_ap_id_with_object(act["id"]) || make_fake_activity(act, user)
24 act when is_binary(act) ->
25 Activity.get_create_by_object_ap_id_with_object(act) ||
26 Activity.get_by_ap_id_with_object(act)
29 %{report: report, user: user, account: account, statuses: statuses}
32 defp make_fake_activity(act, user) do
34 id: "pleroma:fake:#{act["id"]}",
36 "actor" => user.ap_id,
40 "object" => act["id"],
41 "published" => act["published"],
43 "context" => "pleroma:fake"
45 recipients: [user.ap_id],
48 "actor" => user.ap_id,
50 "content" => act["content"],
51 "published" => act["published"],
55 "context" => "pleroma:fake"