Merge remote-tracking branch 'soapbox/develop' into pleroma-events

This commit is contained in:
marcin mikołajczak 2022-11-27 23:34:12 +01:00
commit ec4b8ab4f6
2 changed files with 20 additions and 1 deletions

View file

@ -671,7 +671,7 @@ def update_report_state(activity_ids, state) when is_list(activity_ids) do
end
def update_report_state(activity_id, state) do
with %Activity{} = activity <- Activity.get_by_id(activity_id) do
with %Activity{} = activity <- Activity.get_by_id(activity_id, []) do
Utils.update_report_state(activity, state)
else
nil -> {:error, :not_found}

View file

@ -1204,6 +1204,25 @@ test "updates report state" do
assert activity_id == activity.data["id"]
end
test "update report state when the actor is deactivated" do
[reporter, target_user] = insert_pair(:user)
activity = insert(:note_activity, user: target_user)
{:ok, %Activity{id: report_id}} =
CommonAPI.report(reporter, %{
account_id: target_user.id,
comment: "I feel offended",
status_ids: [activity.id]
})
# Deactivate the reporter (and sanity-check it).
{:ok, reporter} = User.set_activation(reporter, false)
refute reporter.is_active
# We can still close the report.
{:ok, _report} = CommonAPI.update_report_state(report_id, "resolved")
end
test "updates report state, don't strip when report_strip_status is false" do
clear_config([:instance, :report_strip_status], false)