activitypub: mrf: tag policy: add support for subscription control
[akkoma] / lib / pleroma / web / activity_pub / activity_pub_controller.ex
index fadb038a21a9f2e486123715b118130be59d6062..4dea6ab83ee21ac87ee92f750151ef9751d8a76e 100644 (file)
@@ -18,7 +18,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
   action_fallback(:errors)
 
   plug(Pleroma.Web.FederatingPlug when action in [:inbox, :relay])
-  plug(Pleroma.Web.Plugs.SetRequesterReachablePlug when action in [:inbox])
+  plug(:set_requester_reachable when action in [:inbox])
   plug(:relay_active? when action in [:relay])
 
   def relay_active?(conn, _) do
@@ -291,4 +291,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
     |> put_status(500)
     |> json("error")
   end
+
+  defp set_requester_reachable(%Plug.Conn{} = conn, _) do
+    with actor <- conn.params["actor"],
+         true <- is_binary(actor) do
+      Pleroma.Instances.set_reachable(actor)
+    end
+
+    conn
+  end
 end