Ensure self-announces do not widen the audience of the original post
authorThibaut Girka <thib@sitedethib.com>
Tue, 1 Oct 2019 15:49:52 +0000 (17:49 +0200)
committerThibaut Girka <thib@sitedethib.com>
Tue, 1 Oct 2019 16:38:57 +0000 (18:38 +0200)
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/visibility.ex

index c58b48443ed4178ead10123025ef915f173fa293..c52efb57871a5dcc100143957eff6f3bb455116c 100644 (file)
@@ -346,7 +346,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
         local \\ true,
         public \\ true
       ) do
-    with true <- is_announceable?(object, user),
+    with true <- is_announceable?(object, user, public),
          announce_data <- make_announce_data(user, object, activity_id, public),
          {:ok, activity} <- insert(announce_data, local),
          {:ok, object} <- add_announce_to_object(activity, object),
index 021efd30ff5c0b264c8ee1e7727e826a35c03236..270d0fa0211f87146408ae5fead8476c2fb5eb9f 100644 (file)
@@ -27,8 +27,9 @@ defmodule Pleroma.Web.ActivityPub.Visibility do
     end
   end
 
-  def is_announceable?(activity, user) do
-    is_public?(activity) || activity.data["actor"] == user.ap_id
+  def is_announceable?(activity, user, public \\ true) do
+    is_public?(activity) ||
+      (!public && is_private?(activity) && activity.data["actor"] == user.ap_id)
   end
 
   def is_direct?(%Activity{data: %{"directMessage" => true}}), do: true