X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fworkers%2Fpublisher_worker.ex;h=545887071046339bed7a0a68e1b67277d69c6a96;hb=77ed5fc67453f1030de39ce224b48f1846399397;hp=daf79efc04a0eb3cf9c1457620643cb3a0fbfdf6;hpb=15c7e3b4bf15ceb5087dde139bde1eb4f3150627;p=akkoma
diff --git a/lib/pleroma/workers/publisher_worker.ex b/lib/pleroma/workers/publisher_worker.ex
index daf79efc0..545887071 100644
--- a/lib/pleroma/workers/publisher_worker.ex
+++ b/lib/pleroma/workers/publisher_worker.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Workers.PublisherWorker do
@@ -8,17 +8,26 @@ defmodule Pleroma.Workers.PublisherWorker do
use Pleroma.Workers.WorkerHelper, queue: "federator_outgoing"
- def backoff(attempt) when is_integer(attempt) do
+ def backoff(%Job{attempt: attempt}) when is_integer(attempt) do
Pleroma.Workers.WorkerHelper.sidekiq_backoff(attempt, 5)
end
@impl Oban.Worker
- def perform(%{"op" => "publish", "activity_id" => activity_id}, _job) do
+ def perform(%Job{args: %{"op" => "publish", "activity_id" => activity_id, "object_data" => nil}}) do
activity = Activity.get_by_id(activity_id)
Federator.perform(:publish, activity)
end
- def perform(%{"op" => "publish_one", "module" => module_name, "params" => params}, _job) do
+ @impl Oban.Worker
+ def perform(%Job{
+ args: %{"op" => "publish", "activity_id" => activity_id, "object_data" => object_data}
+ }) do
+ activity = Activity.get_by_id(activity_id)
+ activity = %{activity | data: Map.put(activity.data, "object", Jason.decode!(object_data))}
+ Federator.perform(:publish, activity)
+ end
+
+ def perform(%Job{args: %{"op" => "publish_one", "module" => module_name, "params" => params}}) do
params = Map.new(params, fn {k, v} -> {String.to_atom(k), v} end)
Federator.perform(:publish_one, String.to_atom(module_name), params)
end