Render a generated reported activity properly

This commit is contained in:
tusooa 2022-11-09 23:02:27 -05:00
parent 6f047cc308
commit 717c5901f8
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
2 changed files with 32 additions and 2 deletions

View file

@ -36,7 +36,9 @@ defmodule Pleroma.Web.AdminAPI.Report do
"to" => [],
"cc" => [],
"object" => act["id"],
"published" => act["published"]
"published" => act["published"],
"id" => act["id"],
"context" => "pleroma:fake"
},
recipients: [user.ap_id],
object: %Object{
@ -46,7 +48,9 @@ defmodule Pleroma.Web.AdminAPI.Report do
"content" => act["content"],
"published" => act["published"],
"to" => [],
"cc" => []
"cc" => [],
"id" => act["id"],
"context" => "pleroma:fake"
}
}
}

View file

@ -54,6 +54,32 @@ defmodule Pleroma.Web.AdminAPI.ReportControllerTest do
assert notes["content"] == "this is an admin note"
end
test "renders reported content even if the status is deleted", %{conn: conn} do
[reporter, target_user] = insert_pair(:user)
activity = insert(:note_activity, user: target_user)
activity = Activity.normalize(activity)
{:ok, %{id: report_id}} =
CommonAPI.report(reporter, %{
account_id: target_user.id,
comment: "I feel offended",
status_ids: [activity.id]
})
CommonAPI.delete(activity.id, target_user)
response =
conn
|> get("/api/pleroma/admin/reports/#{report_id}")
|> json_response_and_validate_schema(:ok)
assert response["id"] == report_id
assert [status] = response["statuses"]
assert activity.data["id"] == status["uri"]
assert activity.object.data["content"] == status["content"]
end
test "returns 404 when report id is invalid", %{conn: conn} do
conn = get(conn, "/api/pleroma/admin/reports/test")