From 2b628f23410edc310d10e692ae0502136e999fd3 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 6 Aug 2018 08:03:10 +0000 Subject: [PATCH] relay: only relay create activities --- lib/pleroma/web/activity_pub/relay.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/activity_pub/relay.ex b/lib/pleroma/web/activity_pub/relay.ex index f5cf8b7f5..d30853d62 100644 --- a/lib/pleroma/web/activity_pub/relay.ex +++ b/lib/pleroma/web/activity_pub/relay.ex @@ -1,5 +1,5 @@ defmodule Pleroma.Web.ActivityPub.Relay do - alias Pleroma.{User, Object} + alias Pleroma.{User, Object, Activity} alias Pleroma.Web.ActivityPub.ActivityPub require Logger @@ -31,7 +31,7 @@ defmodule Pleroma.Web.ActivityPub.Relay do :ok end - def publish(activity) do + def publish(%Activity{data: %{"type" => "Create"}} = activity) do with %User{} = user <- get_actor(), %Object{} = object <- Object.normalize(activity.data["object"]["id"]) do ActivityPub.announce(user, object) @@ -39,4 +39,6 @@ defmodule Pleroma.Web.ActivityPub.Relay do e -> Logger.error("error: #{inspect(e)}") end end + + def publish(_), do: nil end -- 2.45.2