From: kPherox Date: Sat, 24 Aug 2019 22:04:46 +0000 (+0900) Subject: Change to delete empty name field X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=b15e226593d4d9d58898af5576d2a7e96bed59ae;p=akkoma Change to delete empty name field --- 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