Apply suggestion to lib/pleroma/web/admin_api/controllers/admin_api_controller.ex
authorAlexander Strizhakov <alex.strizhakov@gmail.com>
Wed, 27 May 2020 10:55:42 +0000 (10:55 +0000)
committerAlexander Strizhakov <alex.strizhakov@gmail.com>
Wed, 27 May 2020 10:55:42 +0000 (10:55 +0000)
lib/pleroma/web/admin_api/controllers/admin_api_controller.ex

index 6aedccec61d77762e966e5bf4ed3f58ad3f801a1..783203c071028fcb885bb5f3b056e9237b8300e0 100644 (file)
@@ -715,11 +715,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
       json(conn, %{status: "success"})
     else
       {:error, changeset} ->
-        errors =
-          Enum.reduce(changeset.errors, %{}, fn
-            {key, {error, _}}, acc ->
-              Map.put(acc, key, error)
-          end)
+        errors = Map.new(changeset.errors, fn {key, {error, _}} -> {key, error} end)
 
         json(conn, %{errors: errors})