From: Roger Braun Date: Wed, 10 May 2017 16:45:38 +0000 (+0200) Subject: Add option to keep id for follows. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=a2ca3b86053d0f74106bc65fddd7073d12423bbe;p=akkoma Add option to keep id for follows. --- diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index a5d8af995..75a34c580 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -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)