Merge branch 'from/upstream-develop/tusooa/no-strip-report' into 'develop'
Give admin the choice to not strip reported statuses Closes #2887 See merge request pleroma/pleroma!3773
This commit is contained in:
commit
1b0e47b79b
7 changed files with 107 additions and 15 deletions
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
|
|
@ -1154,6 +1154,32 @@ defmodule Pleroma.Web.CommonAPITest do
|
|||
assert activity_id == activity.data["id"]
|
||||
end
|
||||
|
||||
test "updates report state, don't strip when report_strip_status is false" do
|
||||
clear_config([:instance, :report_strip_status], false)
|
||||
|
||||
[reporter, target_user] = insert_pair(:user)
|
||||
activity = insert(:note_activity, user: target_user)
|
||||
|
||||
{:ok, %Activity{id: report_id, data: report_data}} =
|
||||
CommonAPI.report(reporter, %{
|
||||
account_id: target_user.id,
|
||||
comment: "I feel offended",
|
||||
status_ids: [activity.id]
|
||||
})
|
||||
|
||||
{:ok, report} = CommonAPI.update_report_state(report_id, "resolved")
|
||||
|
||||
assert report.data["state"] == "resolved"
|
||||
|
||||
[reported_user, reported_activity] = report.data["object"]
|
||||
|
||||
assert reported_user == target_user.ap_id
|
||||
assert is_map(reported_activity)
|
||||
|
||||
assert reported_activity["content"] ==
|
||||
report_data["object"] |> Enum.at(1) |> Map.get("content")
|
||||
end
|
||||
|
||||
test "does not update report state when state is unsupported" do
|
||||
[reporter, target_user] = insert_pair(:user)
|
||||
activity = insert(:note_activity, user: target_user)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue