From b7ca7f282ac43fcbda63c822553497baa0009835 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 6 Aug 2018 06:15:22 +0000 Subject: [PATCH] activitypub: refactor relay concerns into new relay module --- lib/pleroma/web/activity_pub/activity_pub_controller.ex | 3 ++- lib/pleroma/web/activity_pub/relay.ex | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 lib/pleroma/web/activity_pub/relay.ex diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index a858b5df9..52b2a467e 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -3,6 +3,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do alias Pleroma.{User, Object} alias Pleroma.Web.ActivityPub.{ObjectView, UserView} alias Pleroma.Web.ActivityPub.ActivityPub + alias Pleroma.Web.ActivityPub.Relay alias Pleroma.Web.Federator require Logger @@ -108,7 +109,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do end def relay(conn, params) do - with %User{} = user <- User.get_or_create_instance_user(), + with %User{} = user <- Relay.get_actor(), {:ok, user} <- Pleroma.Web.WebFinger.ensure_keys_present(user) do conn |> put_resp_header("content-type", "application/activity+json") diff --git a/lib/pleroma/web/activity_pub/relay.ex b/lib/pleroma/web/activity_pub/relay.ex new file mode 100644 index 000000000..736d0e406 --- /dev/null +++ b/lib/pleroma/web/activity_pub/relay.ex @@ -0,0 +1,7 @@ +defmodule Pleroma.Web.ActivityPub.Relay do + alias Pleroma.User + + def get_actor do + User.get_or_create_instance_user() + end +end -- 2.45.2