Stop adding statusnetConversationIds.
[akkoma] / lib / pleroma / web / activity_pub / activity_pub.ex
index e9f0dcd3290bfb213c596c1cca2f4400610d2ace..9441a37aba9b263b51a88176ff64590391fe00b7 100644 (file)
@@ -19,6 +19,28 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     Repo.insert(%Activity{data: map})
   end
 
+  def create(to, actor, context, object, additional \\ %{}, published \\ nil) do
+    published = published || make_date()
+
+    activity = %{
+      "type" => "Create",
+      "to" => to,
+      "actor" => actor.ap_id,
+      "object" => object,
+      "published" => published,
+      "context" => context
+    }
+    |> Map.merge(additional)
+
+    with {:ok, activity} <- insert(activity) do
+      if actor.local do
+        Pleroma.Web.Federator.enqueue(:publish, activity)
+       end
+
+      {:ok, activity}
+    end
+  end
+
   def like(%User{ap_id: ap_id} = user, %Object{data: %{ "id" => id}} = object) do
     cond do
       # There's already a like here, so return the original activity.