From: lain Date: Sun, 18 Feb 2018 14:58:18 +0000 (+0100) Subject: Don't relay non-public messages. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4bc57ef20c7dda871c13946aac6461298a6404ea;p=akkoma Don't relay non-public messages. --- diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 8f660a334..a0b51da89 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -84,7 +84,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end def announce(%User{ap_id: _} = user, %Object{data: %{"id" => _}} = object, activity_id \\ nil, local \\ true) do - with announce_data <- make_announce_data(user, object, activity_id), + with true <- is_public?(object), + announce_data <- make_announce_data(user, object, activity_id), {:ok, activity} <- insert(announce_data, local), {:ok, object} <- add_announce_to_object(activity, object), :ok <- maybe_federate(activity) do @@ -316,9 +317,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end end - def visible_for_user?(activity, nil) do + def is_public?(activity) do "https://www.w3.org/ns/activitystreams#Public" in (activity.data["to"] ++ (activity.data["cc"] || [])) end + + def visible_for_user?(activity, nil) do + is_public?(activity) + end def visible_for_user?(activity, user) do x = [user.ap_id | user.following] y = (activity.data["to"] ++ (activity.data["cc"] || []))