activitypub: announce: add new public parameter
authorWilliam Pitcock <nenolod@dereferenced.org>
Thu, 17 Jan 2019 23:12:42 +0000 (23:12 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Thu, 17 Jan 2019 23:21:31 +0000 (23:21 +0000)
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/utils.ex

index 5b87f746224c8d8d9683b54acf0643907f79894c..8c852edbd82a57e644eab89122f34186c9cd6b18 100644 (file)
@@ -224,10 +224,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
         %User{ap_id: _} = user,
         %Object{data: %{"id" => _}} = object,
         activity_id \\ nil,
-        local \\ true
+        local \\ true,
+        public \\ true
       ) do
     with true <- is_public?(object),
-         announce_data <- make_announce_data(user, object, activity_id),
+         announce_data <- make_announce_data(user, object, activity_id, public),
          {:ok, activity} <- insert(announce_data, local),
          {:ok, object} <- add_announce_to_object(activity, object),
          :ok <- maybe_federate(activity) do
index 6ecab773c7db314a6c9424016099499f27e10dd8..d2e457a680e289278fd90d9b4e5c485b744c2807 100644 (file)
@@ -386,9 +386,10 @@ defmodule Pleroma.Web.ActivityPub.Utils do
   """
   # for relayed messages, we only want to send to subscribers
   def make_announce_data(
-        %User{ap_id: ap_id, nickname: nil} = user,
+        %User{ap_id: ap_id} = user,
         %Object{data: %{"id" => id}} = object,
-        activity_id
+        activity_id,
+        false
       ) do
     data = %{
       "type" => "Announce",
@@ -405,7 +406,8 @@ defmodule Pleroma.Web.ActivityPub.Utils do
   def make_announce_data(
         %User{ap_id: ap_id} = user,
         %Object{data: %{"id" => id}} = object,
-        activity_id
+        activity_id,
+        true
       ) do
     data = %{
       "type" => "Announce",