activitypub: transmogrifier: add necessary translations for kroeg
[akkoma] / lib / pleroma / web / activity_pub / activity_pub_controller.ex
index a6a9b99eff30604563d37981f5114318a2a1bd8c..d337532d0ef46417a45f863cf84c552f709b6bb0 100644 (file)
@@ -15,6 +15,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
       conn
       |> put_resp_header("content-type", "application/activity+json")
       |> json(UserView.render("user.json", %{user: user}))
+    else
+      nil -> {:error, :not_found}
     end
   end
 
@@ -27,9 +29,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
       |> json(ObjectView.render("object.json", %{object: object}))
     else
       {:public?, false} ->
-        conn
-        |> put_status(404)
-        |> json("Not found")
+        {:error, :not_found}
     end
   end
 
@@ -107,6 +107,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
     json(conn, "ok")
   end
 
+  def errors(conn, {:error, :not_found}) do
+    conn
+    |> put_status(404)
+    |> json("Not found")
+  end
+
   def errors(conn, _e) do
     conn
     |> put_status(500)