Fix tests

This commit is contained in:
tusooa 2023-01-04 12:01:58 -05:00 committed by marcin mikołajczak
parent 9555e630fd
commit 792e495180
2 changed files with 7 additions and 2 deletions

View file

@ -9,7 +9,7 @@ defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.MapOfString do
def type, do: :map
def cast(object) do
def cast(%{} = object) do
with {status, %{} = data} when status in [:modified, :ok] <-
MultiLanguage.validate_map(object) do
{:ok, data}
@ -19,6 +19,8 @@ def cast(object) do
end
end
def cast(_), do: :error
def dump(data), do: {:ok, data}
def load(data), do: {:ok, data}

View file

@ -159,7 +159,10 @@ defp language(%{params: %{language: language}} = draft) do
if MultiLanguage.is_good_locale_code?(language) do
%__MODULE__{draft | language: language}
else
add_error(draft, dgettext("errors", "language \"%{language}\" is invalid", language: language))
add_error(
draft,
dgettext("errors", "language \"%{language}\" is invalid", language: language)
)
end
end