pipeline it
authorFloatingGhost <hannah@coffee-and-dreams.uk>
Sun, 12 Dec 2021 19:39:07 +0000 (19:39 +0000)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Sun, 12 Dec 2021 20:12:06 +0000 (20:12 +0000)
lib/pleroma/web/activity_pub/pipeline.ex
lib/pleroma/web/activity_pub/side_effects.ex

index 6831e963fee4131e4916cf51f62630f2d7086fa1..ed61d850c6c8077d8c7d86d1c04c973b9e321784 100644 (file)
@@ -27,7 +27,8 @@ defmodule Pleroma.Web.ActivityPub.Pipeline do
   def common_pipeline(object, meta) do
     case Repo.transaction(fn -> do_common_pipeline(object, meta) end, Utils.query_timeout()) do
       {:ok, {:ok, activity, meta}} ->
-        side_effects().handle_after_transaction(activity, meta)
+        side_effects().handle_after_transaction(meta)
+        side_effects().handle_after_transaction(activity)
         {:ok, activity, meta}
 
       {:ok, value} ->
index a4169d41fdfef69f72467a45444cb38bc10b4c7c..913b664ca94c22ef99bfec70fc53bfeeda52f4ee 100644 (file)
@@ -537,11 +537,16 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
   end
 
   @impl true
-  def handle_after_transaction(activity, meta) do
-    Pleroma.Elasticsearch.put_by_id(activity.id)
+  @impl true
+  def handle_after_transaction(%{data: %{"type" => "Create"}} = activity) do
+    Elasticsearch.put_by_id(activity.id)
+  end
 
+  def handle_after_transaction(meta) do
     meta
     |> send_notifications()
     |> send_streamables()
   end
+
+  def handle_after_transaction(_), do: :ok
 end