federator: publisher: only attempt publishing if we know the activity is representable
authorWilliam Pitcock <nenolod@dereferenced.org>
Sun, 12 May 2019 04:17:17 +0000 (04:17 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Sun, 12 May 2019 05:04:16 +0000 (05:04 +0000)
lib/pleroma/web/federator/publisher.ex

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