diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-04-29 02:53:19 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-04-28 22:32:46 -0500 |
commit | a3d1d4894fdd8dd0133e1d2c6fde9d95f49dfcc7 (patch) | |
tree | 787b34c0db8672d3e6944a1f4a8fd325209e7ffd | |
parent | a7a40bb8f1eaf30f0f0d581089ff3ef45de4087c (diff) | |
download | pleroma-a3d1d4894fdd8dd0133e1d2c6fde9d95f49dfcc7.tar.gz |
ActivityPub core: fix handling of unlisted statuses by leveraging a similar strategy as for blocks
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 984d1162d..9e0b038ed 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -212,11 +212,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 @@ -321,6 +321,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do defp restrict_blocked(query, _), do: query + defp restrict_unlisted(query) do + from( + activity in query, + where: fragment("not (?->'cc' \\?| ?)", activity.data, ^["https://www.w3.org/ns/activitystreams#Public"]) + ) + end + def fetch_activities_query(recipients, opts \\ %{}) do base_query = from( |