From 144c06487a9c6cdbff1d09ba0d93c8fa5a7789a2 Mon Sep 17 00:00:00 2001 From: sadposter Date: Sun, 12 Dec 2021 20:01:07 +0000 Subject: [PATCH] fix buggos --- lib/pleroma/elasticsearch/store.ex | 2 +- lib/pleroma/web/activity_pub/side_effects.ex | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/elasticsearch/store.ex b/lib/pleroma/elasticsearch/store.ex index 17ba71990..f309bf7a5 100644 --- a/lib/pleroma/elasticsearch/store.ex +++ b/lib/pleroma/elasticsearch/store.ex @@ -17,7 +17,7 @@ def maybe_put_into_elasticsearch({:ok, activity}) do maybe_put_into_elasticsearch(activity) end - def maybe_put_into_elasticsearch(%{data: %{"type" => "Create"}, object: %{data: %{type: "Note"}}} = activity) do + def maybe_put_into_elasticsearch(%{data: %{"type" => "Create"}, object: %{data: %{"type" => "Note"}}} = activity) do if Config.get([:search, :provider]) == Pleroma.Search.Elasticsearch do actor = Pleroma.Activity.user_actor(activity) diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index 19e833dec..91e9c72e0 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -537,10 +537,18 @@ defp add_notifications(meta, notifications) do end @impl true - def handle_after_transaction(%{data: %{"type" => "Create"}} = activity) do + def handle_after_transaction(%Pleroma.Activity{data: %{"type" => "Create"}} = activity) do Pleroma.Elasticsearch.put_by_id(activity.id) end + def handle_after_transaction(%Pleroma.Activity{}) do + :ok + end + + def handle_after_transaction(%Pleroma.Object{}) do + :ok + end + def handle_after_transaction(meta) do meta |> send_notifications()