From: Alex Gleason Date: Sat, 29 May 2021 18:32:57 +0000 (-0500) Subject: Merge remote-tracking branch 'pleroma/develop' into cycles-pipeline X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=0de6716f066ca1822967a612a51c25f96aeb60b1;p=akkoma Merge remote-tracking branch 'pleroma/develop' into cycles-pipeline --- 0de6716f066ca1822967a612a51c25f96aeb60b1 diff --cc lib/pleroma/web/activity_pub/pipeline.ex index f04557a47,a0f2e0312..0d6e8aad2 --- a/lib/pleroma/web/activity_pub/pipeline.ex +++ b/lib/pleroma/web/activity_pub/pipeline.ex @@@ -21,9 -25,9 +25,9 @@@ defmodule Pleroma.Web.ActivityPub.Pipel @spec common_pipeline(map(), keyword()) :: {:ok, Activity.t() | Object.t(), keyword()} | {:error, any()} def common_pipeline(object, meta) do - case Repo.transaction(fn -> do_common_pipeline(object, meta) end) do + case Repo.transaction(fn -> do_common_pipeline(object, meta) end, Utils.query_timeout()) do {:ok, {:ok, activity, meta}} -> - @side_effects.handle_after_transaction(meta) + side_effects().handle_after_transaction(meta) {:ok, activity, meta} {:ok, value} -> @@@ -37,19 -41,17 +41,17 @@@ end end - def do_common_pipeline(object, meta) do - with {_, {:ok, validated_object, meta}} <- - {:validate_object, object_validator().validate(object, meta)}, - {_, {:ok, mrfd_object, meta}} <- - {:mrf_object, mrf().pipeline_filter(validated_object, meta)}, - {_, {:ok, activity, meta}} <- - {:persist_object, activity_pub().persist(mrfd_object, meta)}, - {_, {:ok, activity, meta}} <- - {:execute_side_effects, side_effects().handle(activity, meta)}, - {_, {:ok, _}} <- {:federation, maybe_federate(activity, meta)} do - {:ok, activity, meta} + def do_common_pipeline(%{__struct__: _}, _meta), do: {:error, :is_struct} + + def do_common_pipeline(message, meta) do - with {_, {:ok, message, meta}} <- {:validate, @object_validator.validate(message, meta)}, - {_, {:ok, message, meta}} <- {:mrf, @mrf.pipeline_filter(message, meta)}, - {_, {:ok, message, meta}} <- {:persist, @activity_pub.persist(message, meta)}, - {_, {:ok, message, meta}} <- {:side_effects, @side_effects.handle(message, meta)}, ++ with {_, {:ok, message, meta}} <- {:validate, object_validator().validate(message, meta)}, ++ {_, {:ok, message, meta}} <- {:mrf, mrf().pipeline_filter(message, meta)}, ++ {_, {:ok, message, meta}} <- {:persist, activity_pub().persist(message, meta)}, ++ {_, {:ok, message, meta}} <- {:side_effects, side_effects().handle(message, meta)}, + {_, {:ok, _}} <- {:federation, maybe_federate(message, meta)} do + {:ok, message, meta} else - {:mrf_object, {:reject, message, _}} -> {:reject, message} + {:mrf, {:reject, message, _}} -> {:reject, message} e -> {:error, e} end end