Fix reports which do not have a user

The check for deactivated users was being applied to report activities.
This commit is contained in:
Mark Felder 2022-11-12 17:52:37 -05:00 committed by Francis Dinh
parent fb5f846e8c
commit 11fc1beba5
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE

View file

@ -1247,6 +1247,7 @@ defp exclude_poll_votes(query, _) do
end end
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, %{invisible_actors: true}), do: query
defp exclude_invisible_actors(query, _opts) do defp exclude_invisible_actors(query, _opts) do
@ -1385,7 +1386,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do
|> restrict_instance(opts) |> restrict_instance(opts)
|> restrict_announce_object_actor(opts) |> restrict_announce_object_actor(opts)
|> restrict_filtered(opts) |> restrict_filtered(opts)
|> Activity.restrict_deactivated_users() |> maybe_restrict_deactivated_users(opts)
|> exclude_poll_votes(opts) |> exclude_poll_votes(opts)
|> exclude_invisible_actors(opts) |> exclude_invisible_actors(opts)
|> exclude_visibility(opts) |> exclude_visibility(opts)
@ -1813,4 +1814,9 @@ def fetch_direct_messages_query do
|> restrict_visibility(%{visibility: "direct"}) |> restrict_visibility(%{visibility: "direct"})
|> order_by([activity], asc: activity.id) |> order_by([activity], asc: activity.id)
end 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 end