Admin API: Render whole status in grouped reports
This commit is contained in:
parent
937d6c6b32
commit
2b341627da
4 changed files with 31 additions and 17 deletions
|
|
@ -822,20 +822,33 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||
reports = get_reports_by_status_id(activity["id"])
|
||||
max_date = Enum.max_by(reports, &NaiveDateTime.from_iso8601!(&1.data["published"]))
|
||||
actors = Enum.map(reports, & &1.user_actor)
|
||||
{deleted, status} = get_status_data(activity)
|
||||
|
||||
%{
|
||||
date: max_date.data["published"],
|
||||
account: activity["actor"],
|
||||
status: %{
|
||||
id: activity["id"],
|
||||
content: activity["content"],
|
||||
published: activity["published"]
|
||||
},
|
||||
status: status,
|
||||
status_deleted: deleted,
|
||||
actors: Enum.uniq(actors),
|
||||
reports: reports
|
||||
}
|
||||
end
|
||||
|
||||
defp get_status_data(activity) do
|
||||
case Activity.get_by_ap_id(activity["id"]) do
|
||||
%Activity{} = act ->
|
||||
{false, act}
|
||||
|
||||
_ ->
|
||||
{true,
|
||||
%{
|
||||
id: activity["id"],
|
||||
content: activity["content"],
|
||||
published: activity["published"]
|
||||
}}
|
||||
end
|
||||
end
|
||||
|
||||
def get_reports_by_status_id(ap_id) do
|
||||
from(a in Activity,
|
||||
where: fragment("(?)->>'type' = 'Flag'", a.data),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue