end)
end)
|> add_if_present(params, "default_scope", :default_scope)
- |> add_if_present(params, "fields", :fields, fn fields ->
+ |> add_if_present(params, "fields_attributes", :fields, fn fields ->
fields = Enum.map(fields, fn f -> Map.update!(f, "value", &AutoLinker.link(&1)) end)
{:ok, fields}
end)
- |> add_if_present(params, "fields", :raw_fields)
+ |> add_if_present(params, "fields_attributes", :raw_fields)
|> add_if_present(params, "pleroma_settings_store", :pleroma_settings_store, fn value ->
{:ok, Map.merge(user.info.pleroma_settings_store, value)}
end)
account =
conn
|> assign(:user, user)
- |> patch("/api/v1/accounts/update_credentials", %{"fields" => fields})
+ |> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|> json_response(200)
assert account["fields"] == [
assert %{"error" => "Invalid request"} ==
conn
|> assign(:user, user)
- |> patch("/api/v1/accounts/update_credentials", %{"fields" => fields})
+ |> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|> json_response(403)
long_name = Enum.map(0..name_limit, fn _ -> "x" end) |> Enum.join()
assert %{"error" => "Invalid request"} ==
conn
|> assign(:user, user)
- |> patch("/api/v1/accounts/update_credentials", %{"fields" => fields})
+ |> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|> json_response(403)
Pleroma.Config.put([:instance, :max_account_fields], 1)
assert %{"error" => "Invalid request"} ==
conn
|> assign(:user, user)
- |> patch("/api/v1/accounts/update_credentials", %{"fields" => fields})
+ |> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|> json_response(403)
end
end