|
|
@@ -708,6 +708,17 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do |
|
|
|
|> Enum.reverse() |
|
|
|
end |
|
|
|
|
|
|
|
def fetch_instance_activities(params) do |
|
|
|
params = |
|
|
|
params |
|
|
|
|> Map.put("type", ["Create", "Announce"]) |
|
|
|
|> Map.put("instance", params["instance"]) |
|
|
|
|> Map.put("whole_db", true) |
|
|
|
|
|
|
|
fetch_activities([Pleroma.Constants.as_public()], params, :offset) |
|
|
|
|> Enum.reverse() |
|
|
|
end |
|
|
|
|
|
|
|
defp user_activities_recipients(%{"godmode" => true}) do |
|
|
|
[] |
|
|
|
end |
|
|
@@ -935,6 +946,20 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do |
|
|
|
|
|
|
|
defp restrict_muted_reblogs(query, _), do: query |
|
|
|
|
|
|
|
defp restrict_instance(query, %{"instance" => instance}) do |
|
|
|
users = |
|
|
|
from( |
|
|
|
u in User, |
|
|
|
select: u.ap_id, |
|
|
|
where: fragment("? LIKE ?", u.nickname, ^"%@#{instance}") |
|
|
|
) |
|
|
|
|> Repo.all() |
|
|
|
|
|
|
|
from(activity in query, where: activity.actor in ^users) |
|
|
|
end |
|
|
|
|
|
|
|
defp restrict_instance(query, _), do: query |
|
|
|
|
|
|
|
defp exclude_poll_votes(query, %{"include_poll_votes" => true}), do: query |
|
|
|
|
|
|
|
defp exclude_poll_votes(query, _) do |
|
|
@@ -1015,6 +1040,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do |
|
|
|
|> restrict_reblogs(opts) |
|
|
|
|> restrict_pinned(opts) |
|
|
|
|> restrict_muted_reblogs(opts) |
|
|
|
|> restrict_instance(opts) |
|
|
|
|> Activity.restrict_deactivated_users() |
|
|
|
|> exclude_poll_votes(opts) |
|
|
|
|> exclude_visibility(opts) |
|
|
|