diff options
author | lain <lain@soykaf.club> | 2020-12-16 17:51:48 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-12-21 16:35:12 +0100 |
commit | 5db1e6c8d37ea114433afe0a9247314ab92cc52f (patch) | |
tree | b3f390a757f6d21eff3fa63368de129f3747c9da /lib/pleroma/web/federator.ex | |
parent | 0ef0aed205f7298d82649f55615193baac4b3667 (diff) | |
download | pleroma-5db1e6c8d37ea114433afe0a9247314ab92cc52f.tar.gz |
Pipeline test: Switch from Mock to Mox.
Speeds up the test and makes it possible to run async.
Diffstat (limited to 'lib/pleroma/web/federator.ex')
-rw-r--r-- | lib/pleroma/web/federator.ex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/pleroma/web/federator.ex b/lib/pleroma/web/federator.ex index 130654145..186861fd9 100644 --- a/lib/pleroma/web/federator.ex +++ b/lib/pleroma/web/federator.ex @@ -2,6 +2,10 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only +defmodule Pleroma.Web.Federator.Publishing do + @callback publish(map()) :: any() +end + defmodule Pleroma.Web.Federator do alias Pleroma.Activity alias Pleroma.Object.Containment @@ -15,6 +19,8 @@ defmodule Pleroma.Web.Federator do require Logger + @behaviour Pleroma.Web.Federator.Publishing + @doc """ Returns `true` if the distance to target object does not exceed max configured value. Serves to prevent fetching of very long threads, especially useful on smaller instances. @@ -39,10 +45,12 @@ defmodule Pleroma.Web.Federator do ReceiverWorker.enqueue("incoming_ap_doc", %{"params" => params}) end + @impl true def publish(%{id: "pleroma:fakeid"} = activity) do perform(:publish, activity) end + @impl true def publish(activity) do PublisherWorker.enqueue("publish", %{"activity_id" => activity.id}) end |