federator: publisher: only attempt publishing if we know the activity is representable

This commit is contained in:
William Pitcock 2019-05-12 04:17:17 +00:00
parent 69158f1065
commit 2aee62a456

View File

@ -39,7 +39,7 @@ defmodule Pleroma.Web.Federator.Publisher do
{:ok, _} -> {:ok, _} ->
:ok :ok
{:error, _} -> {:error, _e} ->
RetryQueue.enqueue(params, module) RetryQueue.enqueue(params, module)
end end
end end
@ -58,8 +58,10 @@ defmodule Pleroma.Web.Federator.Publisher do
def publish(%User{} = user, %Activity{} = activity) do def publish(%User{} = user, %Activity{} = activity) do
Config.get([:instance, :federation_publisher_modules]) Config.get([:instance, :federation_publisher_modules])
|> Enum.each(fn module -> |> Enum.each(fn module ->
if module.is_representable?(activity) do
Logger.info("Publishing #{activity.data["id"]} using #{inspect(module)}") Logger.info("Publishing #{activity.data["id"]} using #{inspect(module)}")
module.publish(user, activity) module.publish(user, activity)
end
end) end)
:ok :ok