activitypub: allow is_public?() to work on any type of map representing an AS2 object

This commit is contained in:
William Pitcock 2019-01-17 23:17:59 +00:00
parent 8e9f1d5587
commit 33b473cc02
1 changed files with 4 additions and 6 deletions

View File

@ -797,13 +797,11 @@ def fetch_and_contain_remote_object_from_id(id) do
end
end
def is_public?(%Object{data: %{"type" => "Tombstone"}}) do
false
end
def is_public?(%Object{data: %{"type" => "Tombstone"}}), do: false
def is_public?(%Activity{data: data}), do: is_public?(data)
def is_public?(activity) do
"https://www.w3.org/ns/activitystreams#Public" in (activity.data["to"] ++
(activity.data["cc"] || []))
def is_public?(data) do
"https://www.w3.org/ns/activitystreams#Public" in (data["to"] ++ (data["cc"] || []))
end
def visible_for_user?(activity, nil) do