aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhil Hagelberg <phil@hagelb.org>2019-11-11 17:16:44 -0800
committerPhil Hagelberg <phil@hagelb.org>2019-11-12 09:40:29 -0800
commit62f3a93049649dee0ccd7b883887be2fd343fb3e (patch)
tree3bba8ee493ec32a3f612c4f0011f6f0cc63b4640 /lib
parentfb090b748ab7ec3740008017f419e210405e2633 (diff)
downloadpleroma-62f3a93049649dee0ccd7b883887be2fd343fb3e.tar.gz
For remote notices, redirect to the original instead of 404.
We shouldn't treat these like local statuses, but I don't think a 404 is the right choice either here, because within pleroma-fe, these are valid URLs. So with remote notices you have the awkward situation where clicking a link will behave differently depending on whether you open it in a new tab or not; the new tab will 404 if it hits static-fe. This new redirecting behavior should improve that situation.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/static_fe/static_fe_controller.ex5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex
index 5e60c82b0..ba44b8a4f 100644
--- a/lib/pleroma/web/static_fe/static_fe_controller.ex
+++ b/lib/pleroma/web/static_fe/static_fe_controller.ex
@@ -77,6 +77,11 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
render(conn, "conversation.html", %{activities: timeline, meta: meta})
else
+ %Activity{object: %Object{data: data}} ->
+ conn
+ |> put_status(:found)
+ |> redirect(external: data["url"] || data["external_url"] || data["id"])
+
_ ->
conn
|> put_status(404)