Make activity announceable by its author.
authorKokaKiwi <kokakiwi@kokakiwi.net>
Sun, 24 Feb 2019 17:45:29 +0000 (18:45 +0100)
committerThibaut Girka <thib@sitedethib.com>
Tue, 1 Oct 2019 15:47:43 +0000 (17:47 +0200)
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/visibility.ex

index 95f994c17055470ea885120561808c5b54c87d99..c58b48443ed4178ead10123025ef915f173fa293 100644 (file)
@@ -346,7 +346,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
         local \\ true,
         public \\ true
       ) do
-    with true <- is_public?(object),
+    with true <- is_announceable?(object, user),
          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 dfb166b65e78a161f1303171372f3649742d5c4c..021efd30ff5c0b264c8ee1e7727e826a35c03236 100644 (file)
@@ -27,6 +27,10 @@ defmodule Pleroma.Web.ActivityPub.Visibility do
     end
   end
 
+  def is_announceable?(activity, user) do
+    is_public?(activity) || activity.data["actor"] == user.ap_id
+  end
+
   def is_direct?(%Activity{data: %{"directMessage" => true}}), do: true
   def is_direct?(%Object{data: %{"directMessage" => true}}), do: true