mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Don't relay non-public messages.
This commit is contained in:
parent
5d89997a70
commit
4bc57ef20c
1 changed files with 7 additions and 2 deletions
|
@ -84,7 +84,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
end
|
end
|
||||||
|
|
||||||
def announce(%User{ap_id: _} = user, %Object{data: %{"id" => _}} = object, activity_id \\ nil, local \\ true) do
|
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, activity} <- insert(announce_data, local),
|
||||||
{:ok, object} <- add_announce_to_object(activity, object),
|
{:ok, object} <- add_announce_to_object(activity, object),
|
||||||
:ok <- maybe_federate(activity) do
|
:ok <- maybe_federate(activity) do
|
||||||
|
@ -316,9 +317,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
end
|
end
|
||||||
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"] || []))
|
"https://www.w3.org/ns/activitystreams#Public" in (activity.data["to"] ++ (activity.data["cc"] || []))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def visible_for_user?(activity, nil) do
|
||||||
|
is_public?(activity)
|
||||||
|
end
|
||||||
def visible_for_user?(activity, user) do
|
def visible_for_user?(activity, user) do
|
||||||
x = [user.ap_id | user.following]
|
x = [user.ap_id | user.following]
|
||||||
y = (activity.data["to"] ++ (activity.data["cc"] || []))
|
y = (activity.data["to"] ++ (activity.data["cc"] || []))
|
||||||
|
|
Loading…
Reference in a new issue