summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkPherox <admin@mail.kr-kp.com>2019-08-25 07:04:46 +0900
committerkPherox <admin@mail.kr-kp.com>2019-08-25 07:34:15 +0900
commitb15e226593d4d9d58898af5576d2a7e96bed59ae (patch)
treeac2dbfb5fb809228d465fbbd556c674b88bfbb34
parent705b5adfc436b18ab3d1b8ff94274d9a2a6a6912 (diff)
downloadpleroma-b15e226593d4d9d58898af5576d2a7e96bed59ae.tar.gz
pleroma-b15e226593d4d9d58898af5576d2a7e96bed59ae.zip
Change to delete empty name field
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index 2826cee8c..ca2230630 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -144,8 +144,15 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|> 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))
+ if Map.has_key?(params, "fields_attributes") do
+ 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
params
end