1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-12-25 04:53:06 +00:00

Discard identifier, if empty

This commit is contained in:
Maxim Filippov 2019-10-01 19:43:22 +03:00
parent 0f9c2c8b87
commit b2273c695e

View file

@ -13,12 +13,17 @@ defmacro render_error(
quote do
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)
|> Plug.Conn.put_status(unquote(status))
|> Phoenix.Controller.json(%{
error: Pleroma.Web.Gettext.dgettext("errors", unquote(msgid), unquote(bindings)),
identifier: unquote(identifier)
})
|> Phoenix.Controller.json(error_map)
end
end
end