mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-02 14:44:13 +00:00
Change to delete empty name field
This commit is contained in:
parent
313b134fac
commit
db6c5aa66a
|
@ -144,8 +144,15 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
||||||
|> Enum.dedup()
|
|> Enum.dedup()
|
||||||
|
|
||||||
params =
|
params =
|
||||||
if Map.has_key?(params, "fields_attributes") && Enum.all?(params["fields_attributes"], &is_tuple/1) do
|
if Map.has_key?(params, "fields_attributes") do
|
||||||
Map.update!(params, "fields_attributes", &Enum.map(&1, fn {_, v} -> v end))
|
Map.update!(params, "fields_attributes", fn fields ->
|
||||||
|
if Enum.all?(fields, &is_tuple/1) do
|
||||||
|
Enum.map(fields, fn {_, v} -> v end)
|
||||||
|
else
|
||||||
|
fields
|
||||||
|
end
|
||||||
|
|> Enum.filter(fn %{"name" => n} -> n != "" end)
|
||||||
|
end)
|
||||||
else
|
else
|
||||||
params
|
params
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue