activitypub: add is_private?/is_direct? helpers

This commit is contained in:
William Pitcock 2018-12-23 15:27:08 +00:00
parent 9adc80afff
commit ddae43eb43

View file

@ -805,6 +805,14 @@ def is_public?(data) do
"https://www.w3.org/ns/activitystreams#Public" in (data["to"] ++ (data["cc"] || []))
end
def is_private?(activity) do
!is_public?(activity) && Enum.any?(activity.data["to"], &String.contains?(&1, "/followers"))
end
def is_direct?(activity) do
!is_public?(activity) && !is_private?(activity)
end
def visible_for_user?(activity, nil) do
is_public?(activity)
end