From 33b473cc021d2d027c11021178af90298230e06e Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 17 Jan 2019 23:17:59 +0000 Subject: [PATCH] activitypub: allow is_public?() to work on any type of map representing an AS2 object --- lib/pleroma/web/activity_pub/activity_pub.ex | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 8c852edbd..92c5ce2ae 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -797,13 +797,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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 -- 2.45.2