From 7502da993ba7080179833a8fcf8bbe2a9e1269d8 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Sun, 12 Dec 2021 19:39:07 +0000 Subject: [PATCH] pipeline it --- lib/pleroma/web/activity_pub/pipeline.ex | 3 ++- lib/pleroma/web/activity_pub/side_effects.ex | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/activity_pub/pipeline.ex b/lib/pleroma/web/activity_pub/pipeline.ex index 6831e963f..ed61d850c 100644 --- a/lib/pleroma/web/activity_pub/pipeline.ex +++ b/lib/pleroma/web/activity_pub/pipeline.ex @@ -27,7 +27,8 @@ defp config, do: Config.get([:pipeline, :config], Config) 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} -> diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index a4169d41f..913b664ca 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -537,11 +537,16 @@ defp add_notifications(meta, notifications) 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