aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hagelberg <phil@hagelb.org>2019-11-05 22:00:19 -0800
committerPhil Hagelberg <phil@hagelb.org>2019-11-09 18:08:08 -0800
commitb0080fa73010cda34215baeee230481b5c56dbca (patch)
treee273f383bea04dd1de00a321023c9a0ddeefbdc2
parente27c61218d292c5fbf268f27e81dbe22f93ba90f (diff)
downloadpleroma-b0080fa73010cda34215baeee230481b5c56dbca.tar.gz
Render errors in HTML, not with JS.
-rw-r--r--lib/pleroma/web/static_fe/static_fe_controller.ex4
-rw-r--r--lib/pleroma/web/templates/layout/static_fe.html.eex2
-rw-r--r--lib/pleroma/web/templates/static_fe/static_fe/error.html.eex7
3 files changed, 10 insertions, 3 deletions
diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex
index 10bd3fecd..0be47d6b3 100644
--- a/lib/pleroma/web/static_fe/static_fe_controller.ex
+++ b/lib/pleroma/web/static_fe/static_fe_controller.ex
@@ -78,7 +78,7 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
_ ->
conn
|> put_status(404)
- |> render_error(:not_found, "Notice not found")
+ |> render("error.html", %{message: "Post not found.", meta: ""})
end
end
@@ -108,7 +108,7 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
_ ->
conn
|> put_status(404)
- |> render_error(:not_found, "User not found")
+ |> render("error.html", %{message: "User not found.", meta: ""})
end
end
diff --git a/lib/pleroma/web/templates/layout/static_fe.html.eex b/lib/pleroma/web/templates/layout/static_fe.html.eex
index 5d820bb4b..819632cec 100644
--- a/lib/pleroma/web/templates/layout/static_fe.html.eex
+++ b/lib/pleroma/web/templates/layout/static_fe.html.eex
@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui" />
<title><%= Pleroma.Config.get([:instance, :name]) %></title>
- <%= Phoenix.HTML.raw(@meta || "") %>
+ <%= Phoenix.HTML.raw(assigns[:meta] || "") %>
<link rel="stylesheet" href="/static/static-fe.css">
</head>
<body>
diff --git a/lib/pleroma/web/templates/static_fe/static_fe/error.html.eex b/lib/pleroma/web/templates/static_fe/static_fe/error.html.eex
new file mode 100644
index 000000000..d98a1eba7
--- /dev/null
+++ b/lib/pleroma/web/templates/static_fe/static_fe/error.html.eex
@@ -0,0 +1,7 @@
+<header>
+ <h1><%= gettext("Oops") %></h1>
+</header>
+
+<main>
+ <p><%= @message %></p>
+</main>