aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2018-05-13 11:19:08 +0200
committerlain <lain@soykaf.club>2018-05-13 11:19:08 +0200
commit7e9f14bf3ca95fda9042e10b44b80d8441fa3c42 (patch)
treec88433b25c4784e425d8c2ae777781ffc2f8bacf /lib
parentbb864e96ad4e0be470da78baa000019f571e30db (diff)
parentec531ca281008e7d8d9d659e6f046a551fcb7c8a (diff)
downloadpleroma-7e9f14bf3ca95fda9042e10b44b80d8441fa3c42.tar.gz
Merge branch 'kaniini/pleroma-bugfix/unlisted-statuses' into develop
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(