X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fcommon_api.ex;h=3266b1c607017676a00dcb8dd2d45969b8e74a46;hb=3a9b83413ed123680b83680ecc3da55c58019fb5;hp=95ac7b71a8a5394a0cf42b5d70f94b3d071b76c3;hpb=3478492945d7069545593cc0e6e6b9e536ddb489;p=akkoma diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index 95ac7b71a..3266b1c60 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -16,8 +16,6 @@ defmodule Pleroma.Web.CommonAPI do alias Pleroma.Web.ActivityPub.Utils alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.CommonAPI.ActivityDraft - alias Pleroma.Elasticsearch - alias Pleroma.Config import Pleroma.Web.Gettext import Pleroma.Web.CommonAPI.Utils @@ -397,23 +395,14 @@ defmodule Pleroma.Web.CommonAPI do end end - def maybe_put_into_elasticsearch({:ok, activity}) do - if Config.get([:search, :provider]) == :elasticsearch do - actor = Pleroma.Activity.user_actor(activity) - activity - |> Map.put(:user_actor, actor) - |> Elasticsearch.put() - end - end - - def maybe_put_into_elasticsearch(_) do - {:ok, :skipped} - end - def post(user, %{status: _} = data) do with {:ok, draft} <- ActivityDraft.create(user, data) do activity = ActivityPub.create(draft.changes, draft.preview?) - maybe_put_into_elasticsearch(activity) + + unless draft.preview? do + Pleroma.Elasticsearch.maybe_put_into_elasticsearch(activity) + end + activity end end