properly check for follower address in is_private?
authorrinpatch <rinpatch@sdf.org>
Tue, 19 Feb 2019 10:23:13 +0000 (13:23 +0300)
committerrinpatch <rinpatch@sdf.org>
Tue, 19 Feb 2019 10:23:13 +0000 (13:23 +0300)
lib/pleroma/web/activity_pub/activity_pub.ex

index ab2872f56aadcc36e87da85c0ccc795b469e10dc..839b6ce2ad165f21a3f1d9decee4950f6b44c11f 100644 (file)
@@ -876,7 +876,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
   end
 
   def is_private?(activity) do
-    !is_public?(activity) && Enum.any?(activity.data["to"], &String.contains?(&1, "/followers"))
+    unless is_public?(activity) do
+      follower_address = User.get_cached_by_ap_id(activity.data["actor"]).follower_address
+      Enum.any?(activity.data["to"], &(&1 == follower_address))
+    else
+      false
+    end
   end
 
   def is_direct?(%Activity{data: %{"directMessage" => true}}), do: true