Render errors in HTML, not with JS.
authorPhil Hagelberg <phil@hagelb.org>
Wed, 6 Nov 2019 06:00:19 +0000 (22:00 -0800)
committerPhil Hagelberg <phil@hagelb.org>
Sun, 10 Nov 2019 02:08:08 +0000 (18:08 -0800)
lib/pleroma/web/static_fe/static_fe_controller.ex
lib/pleroma/web/templates/layout/static_fe.html.eex
lib/pleroma/web/templates/static_fe/static_fe/error.html.eex [new file with mode: 0644]

index 10bd3fecd4ed8ac4ef3420d91c0bebd1c810f352..0be47d6b350a8c2db72a2d821e149baa649b414f 100644 (file)
@@ -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
 
index 5d820bb4bf36a2df8fc75d97a406937ef1d97d61..819632cec27c7e2c01003cf8139b4c5d94497df1 100644 (file)
@@ -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 (file)
index 0000000..d98a1eb
--- /dev/null
@@ -0,0 +1,7 @@
+<header>
+  <h1><%= gettext("Oops") %></h1>
+</header>
+
+<main>
+  <p><%= @message %></p>
+</main>