diff options
author | Maxim Filippov <colixer@gmail.com> | 2019-10-01 19:43:22 +0300 |
---|---|---|
committer | Maxim Filippov <colixer@gmail.com> | 2019-10-01 19:43:22 +0300 |
commit | b2273c695ec3a84dfb7a3a83019a71cade08b8d4 (patch) | |
tree | 63fd789acad647412c4ef905c80a128be2720ec7 /lib | |
parent | 0f9c2c8b87672517aa040a2cbe1c297b29acc317 (diff) | |
download | pleroma-b2273c695ec3a84dfb7a3a83019a71cade08b8d4.tar.gz |
Discard identifier, if empty
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/translation_helpers.ex | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/pleroma/web/translation_helpers.ex b/lib/pleroma/web/translation_helpers.ex index 7a2ddc008..a104ea6b8 100644 --- a/lib/pleroma/web/translation_helpers.ex +++ b/lib/pleroma/web/translation_helpers.ex @@ -13,12 +13,17 @@ defmodule Pleroma.Web.TranslationHelpers do 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 |