mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-09 09:52:13 +00:00
Merge pull request 'Additional timeline query improvements from upstream' (#291) from norm/akkoma:timeline-query-improvements into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/291
This commit is contained in:
commit
6223e2ea3e
|
@ -1247,15 +1247,15 @@ 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
|
||||
invisible_ap_ids =
|
||||
User.Query.build(%{invisible: true, select: [:ap_id]})
|
||||
|> Repo.all()
|
||||
|> Enum.map(fn %{ap_id: ap_id} -> ap_id end)
|
||||
|
||||
from([activity] in query, where: activity.actor not in ^invisible_ap_ids)
|
||||
query
|
||||
|> join(:inner, [activity], u in User,
|
||||
as: :u,
|
||||
on: activity.actor == u.ap_id and u.invisible == false
|
||||
)
|
||||
end
|
||||
|
||||
defp exclude_id(query, %{exclude_id: id}) when is_binary(id) do
|
||||
|
@ -1385,7 +1385,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 +1813,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
|
||||
|
|
Loading…
Reference in a new issue