Improve Backend Error page
Mostly handle things properly when the front-end is missing Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -63,16 +63,26 @@ defmodule Mobilizon.Web.PageView do
|
||||
|
||||
def render(page, %{object: object, conn: conn} = _assigns)
|
||||
when page in ["actor.html", "event.html", "comment.html", "post.html"] do
|
||||
locale = get_locale(conn)
|
||||
tags = object |> Metadata.build_tags(locale)
|
||||
inject_tags(tags, locale)
|
||||
with locale <- get_locale(conn),
|
||||
tags <- object |> Metadata.build_tags(locale),
|
||||
{:ok, html} <- inject_tags(tags, locale) do
|
||||
html
|
||||
else
|
||||
{:error, error} ->
|
||||
return_error(conn, error)
|
||||
end
|
||||
end
|
||||
|
||||
# Discussions are private, no need to embed metadata
|
||||
def render("discussion.html", params), do: render("index.html", params)
|
||||
|
||||
def render("index.html", %{conn: conn}) do
|
||||
tags = Instance.build_tags()
|
||||
inject_tags(tags, get_locale(conn))
|
||||
with tags <- Instance.build_tags(),
|
||||
{:ok, html} <- inject_tags(tags, get_locale(conn)) do
|
||||
html
|
||||
else
|
||||
{:error, error} ->
|
||||
return_error(conn, error)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user