forked from AkkomaGang/akkoma
Discard identifier, if empty
This commit is contained in:
parent
0f9c2c8b87
commit
b2273c695e
1 changed files with 9 additions and 4 deletions
|
@ -13,12 +13,17 @@ defmacro render_error(
|
||||||
quote do
|
quote do
|
||||||
require Pleroma.Web.Gettext
|
require Pleroma.Web.Gettext
|
||||||
|
|
||||||
|
error_map =
|
||||||
|
%{
|
||||||
|
error: Pleroma.Web.Gettext.dgettext("errors", unquote(msgid), unquote(bindings)),
|
||||||
|
identifier: unquote(identifier)
|
||||||
|
}
|
||||||
|
|> Enum.reject(fn {_k, v} -> v == "" end)
|
||||||
|
|> Map.new()
|
||||||
|
|
||||||
unquote(conn)
|
unquote(conn)
|
||||||
|> Plug.Conn.put_status(unquote(status))
|
|> Plug.Conn.put_status(unquote(status))
|
||||||
|> Phoenix.Controller.json(%{
|
|> Phoenix.Controller.json(error_map)
|
||||||
error: Pleroma.Web.Gettext.dgettext("errors", unquote(msgid), unquote(bindings)),
|
|
||||||
identifier: unquote(identifier)
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue