forked from AkkomaGang/akkoma
activitypub: add is_private?/is_direct? helpers
This commit is contained in:
parent
9adc80afff
commit
ddae43eb43
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue