2019-09-23 16:33:59 -06:00
|
|
|
# Pleroma: A lightweight social networking server
|
2020-03-03 15:44:49 -07:00
|
|
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
2019-09-23 16:33:59 -06:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.AdminAPI.Report do
|
|
|
|
alias Pleroma.Activity
|
|
|
|
alias Pleroma.User
|
|
|
|
|
|
|
|
def extract_report_info(
|
|
|
|
%{data: %{"actor" => actor, "object" => [account_ap_id | status_ap_ids]}} = report
|
|
|
|
) do
|
|
|
|
user = User.get_cached_by_ap_id(actor)
|
|
|
|
account = User.get_cached_by_ap_id(account_ap_id)
|
|
|
|
|
|
|
|
statuses =
|
2019-10-27 07:33:58 -06:00
|
|
|
Enum.map(status_ap_ids, fn
|
|
|
|
act when is_map(act) -> Activity.get_by_ap_id_with_object(act["id"])
|
|
|
|
act when is_binary(act) -> Activity.get_by_ap_id_with_object(act)
|
2019-09-23 16:33:59 -06:00
|
|
|
end)
|
|
|
|
|
|
|
|
%{report: report, user: user, account: account, statuses: statuses}
|
|
|
|
end
|
|
|
|
end
|