Fix type of fields_attributes

Convert tuple list to map list when parameters is `:urlencoded` or `:multipart`
This commit is contained in:
kPherox 2019-08-25 07:02:32 +09:00 committed by Ariadne Conill
parent 81abee22b6
commit 313b134fac
1 changed files with 7 additions and 0 deletions

View File

@ -143,6 +143,13 @@ def update_credentials(%{assigns: %{user: user}} = conn, params) do
|> Enum.concat(Formatter.get_emoji_map(emojis_text))
|> Enum.dedup()
params =
if Map.has_key?(params, "fields_attributes") && Enum.all?(params["fields_attributes"], &is_tuple/1) do
Map.update!(params, "fields_attributes", &Enum.map(&1, fn {_, v} -> v end))
else
params
end
info_params =
[
:no_rich_text,