aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index 956c223ee..8086c830c 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -211,11 +211,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
Repo.all(query)
end
- # TODO: Make this work properly with unlisted.
def fetch_public_activities(opts \\ %{}) do
q = fetch_activities_query(["https://www.w3.org/ns/activitystreams#Public"], opts)
q
+ |> restrict_unlisted()
|> Repo.all()
|> Enum.reverse()
end
@@ -322,6 +322,18 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
defp restrict_blocked(query, _), do: query
+ defp restrict_unlisted(query) do
+ from(
+ activity in query,
+ where:
+ fragment(
+ "(?->'to' \\?| ?)",
+ activity.data,
+ ^["https://www.w3.org/ns/activitystreams#Public"]
+ )
+ )
+ end
+
def fetch_activities_query(recipients, opts \\ %{}) do
base_query =
from(