Restrict poll replies from fetch queries by default

This commit is contained in:
rinpatch 2019-05-19 17:44:18 +03:00
parent 1d90f9b969
commit 6430cb1bf7

View file

@ -820,6 +820,16 @@ defp restrict_muted_reblogs(query, %{"muting_user" => %User{info: info}}) do
defp restrict_muted_reblogs(query, _), do: query
defp restrict_poll_replies(query, %{"include_poll_replies" => "true"}), do: query
defp restrict_poll_replies(query, _) do
if has_named_binding?(query, :object) do
from([activity, object: o] in query, where: fragment("?->'name' is null", o.data))
else
query
end
end
defp maybe_preload_objects(query, %{"skip_preload" => true}), do: query
defp maybe_preload_objects(query, _) do
@ -873,6 +883,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do
|> restrict_pinned(opts)
|> restrict_muted_reblogs(opts)
|> Activity.restrict_deactivated_users()
|> restrict_poll_replies(opts)
end
def fetch_activities(recipients, opts \\ %{}) do