Add option to keep id for follows.
authorRoger Braun <roger@rogerbraun.net>
Wed, 10 May 2017 16:45:38 +0000 (18:45 +0200)
committerRoger Braun <roger@rogerbraun.net>
Wed, 10 May 2017 16:45:38 +0000 (18:45 +0200)
lib/pleroma/web/activity_pub/activity_pub.ex

index a5d8af995fdb12ec7181630a990e49c3e4f6d5db..75a34c58096ae4f65665590ebd9d691ef62b1b3a 100644 (file)
@@ -218,7 +218,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     {:ok, activity, object}
   end
 
-  def follow(%User{ap_id: follower_id, local: actor_local}, %User{ap_id: followed_id}, local \\ true) do
+  def follow(%User{ap_id: follower_id, local: actor_local}, %User{ap_id: followed_id}, activity_id \\ nil, local \\ true) do
     data = %{
       "type" => "Follow",
       "actor" => follower_id,
@@ -227,6 +227,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
       "published" => make_date()
     }
 
+    data = if activity_id, do: Map.put(data, "id", activity_id), else: data
+
     with {:ok, activity} <- insert(data, local) do
       if actor_local do
         Pleroma.Web.Federator.enqueue(:publish, activity)