From 71bb90073b773bad1e4783bb574902f7dc0b4976 Mon Sep 17 00:00:00 2001 From: href Date: Sun, 27 Jan 2019 22:51:50 +0100 Subject: [PATCH] /notice/:id - send the FE index even if 404 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 | 7 +++++-- lib/pleroma/web/router.ex | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/ostatus/ostatus_controller.ex index 823619edb..297aca2f9 100644 --- a/lib/pleroma/web/ostatus/ostatus_controller.ex +++ b/lib/pleroma/web/ostatus/ostatus_controller.ex @@ -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 diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index e749aa834..31f739738 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -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 -- 2.45.2