Do not strip reported statuses when configured not to

This commit is contained in:
tusooa 2022-11-09 22:36:42 -05:00
commit 6f047cc308
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
5 changed files with 74 additions and 15 deletions

View file

@ -4,6 +4,7 @@
defmodule Pleroma.Web.AdminAPI.Report do
alias Pleroma.Activity
alias Pleroma.Object
alias Pleroma.User
def extract_report_info(
@ -16,10 +17,38 @@ defmodule Pleroma.Web.AdminAPI.Report do
status_ap_ids
|> Enum.reject(&is_nil(&1))
|> Enum.map(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)
act when is_map(act) ->
Activity.get_by_ap_id_with_object(act["id"]) || make_fake_activity(act, user)
act when is_binary(act) ->
Activity.get_by_ap_id_with_object(act)
end)
%{report: report, user: user, account: account, statuses: statuses}
end
defp make_fake_activity(act, user) do
%Activity{
id: "pleroma:fake",
data: %{
"actor" => user.ap_id,
"type" => "Create",
"to" => [],
"cc" => [],
"object" => act["id"],
"published" => act["published"]
},
recipients: [user.ap_id],
object: %Object{
data: %{
"actor" => user.ap_id,
"type" => "Note",
"content" => act["content"],
"published" => act["published"],
"to" => [],
"cc" => []
}
}
}
end
end