From: Maxim Filippov Date: Tue, 1 Oct 2019 16:43:22 +0000 (+0300) Subject: Discard identifier, if empty X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=b2273c695ec3a84dfb7a3a83019a71cade08b8d4;p=akkoma Discard identifier, if empty --- 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