Fix tests
This commit is contained in:
parent
9555e630fd
commit
792e495180
2 changed files with 7 additions and 2 deletions
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue