Fix reports which do not have a user
authorMark Felder <feld@feld.me>
Sat, 12 Nov 2022 22:52:37 +0000 (17:52 -0500)
committerFrancis Dinh <normandy@biribiri.dev>
Sat, 19 Nov 2022 20:12:16 +0000 (15:12 -0500)
The check for deactivated users was being applied to report activities.

lib/pleroma/web/activity_pub/activity_pub.ex

index 254d91a7e9f9911af91c8ad02fe472d968be2f96..5f7541b027df388afe975dda6d50f6498ea55880 100644 (file)
@@ -1247,6 +1247,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     end
   end
 
+  defp exclude_invisible_actors(query, %{type: "Flag"}), do: query
   defp exclude_invisible_actors(query, %{invisible_actors: true}), do: query
 
   defp exclude_invisible_actors(query, _opts) do
@@ -1385,7 +1386,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
       |> restrict_instance(opts)
       |> restrict_announce_object_actor(opts)
       |> restrict_filtered(opts)
-      |> Activity.restrict_deactivated_users()
+      |> maybe_restrict_deactivated_users(opts)
       |> exclude_poll_votes(opts)
       |> exclude_invisible_actors(opts)
       |> exclude_visibility(opts)
@@ -1813,4 +1814,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     |> restrict_visibility(%{visibility: "direct"})
     |> order_by([activity], asc: activity.id)
   end
+
+  defp maybe_restrict_deactivated_users(activity, %{type: "Flag"}), do: activity
+
+  defp maybe_restrict_deactivated_users(activity, _opts),
+    do: Activity.restrict_deactivated_users(activity)
 end