/notice/:id - send the FE index even if 404
authorhref <href@random.sh>
Sun, 27 Jan 2019 21:51:50 +0000 (22:51 +0100)
committerhref <href@random.sh>
Sun, 27 Jan 2019 21:51:50 +0000 (22:51 +0100)
this allows to open private activities by URL when you are logged in,
and to let the FE display a 404 page

lib/pleroma/web/ostatus/ostatus_controller.ex
lib/pleroma/web/router.ex

index 823619edb5b45cf11b540d0b3b3107634ba16439..297aca2f976948ef18c6a373fb39d19c38416217 100644 (file)
@@ -166,10 +166,13 @@ defmodule Pleroma.Web.OStatus.OStatusController do
       end
     else
       {:public?, false} ->
-        {:error, :not_found}
+        conn
+        |> put_status(404)
+        |> Fallback.RedirectController.redirector(nil, 404)
 
       {:activity, nil} ->
-        {:error, :not_found}
+        conn
+        |> Fallback.RedirectController.redirector(nil, 404)
 
       e ->
         e
index e749aa834643f36b5d5be490af700e2c82fe9f77..31f739738d32793e0e3f773269ee3e4c527d5801 100644 (file)
@@ -523,10 +523,10 @@ defmodule Fallback.RedirectController do
   alias Pleroma.Web.Metadata
   alias Pleroma.User
 
-  def redirector(conn, _params) do
+  def redirector(conn, _params, code \\ 200) do
     conn
     |> put_resp_content_type("text/html")
-    |> send_file(200, index_file_path())
+    |> send_file(code, index_file_path())
   end
 
   def redirector_with_meta(conn, %{"maybe_nickname_or_id" => maybe_nickname_or_id} = params) do