From d933fd3d61df2f9c346ab08fb2c95ddc12803858 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 10 Jan 2020 19:49:40 +0300 Subject: [PATCH] more renamings --- docs/API/admin_api.md | 8 ++++---- lib/pleroma/web/admin_api/admin_api_controller.ex | 10 ++++++++-- test/web/admin_api/admin_api_controller_test.exs | 12 ++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index f2a0906b8..37cd1910d 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -674,7 +674,7 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` - Params: none - Response: - On failure: - - 400 Bad Request `"To use this endpoint you need to enable dynamic configuration."` + - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` ```json {} @@ -689,8 +689,8 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` - Params: none - Response: - On failure: - - 400 Bad Request `"To use this endpoint you need to enable dynamic configuration."` - - 400 Bad Request `"To use dynamic configuration migrate your settings to database."` + - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` + - 400 Bad Request `"To use configuration from database migrate your settings to database."` ```json { @@ -826,7 +826,7 @@ config :quack, - Response: - On failure: - - 400 Bad Request `"To use this endpoint you need to enable dynamic configuration."` + - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` ```json { configs: [ diff --git a/lib/pleroma/web/admin_api/admin_api_controller.ex b/lib/pleroma/web/admin_api/admin_api_controller.ex index 849641113..a13dd4775 100644 --- a/lib/pleroma/web/admin_api/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/admin_api_controller.ex @@ -802,7 +802,10 @@ def config_show(conn, _params) do configs = Pleroma.Repo.all(Config) if configs == [] do - errors(conn, {:error, "To use dynamic configuration migrate your settings to database."}) + errors( + conn, + {:error, "To use configuration from database migrate your settings to database."} + ) else conn |> put_view(ConfigView) @@ -847,7 +850,10 @@ defp configurable_from_database(conn) do if Pleroma.Config.get([:configurable_from_database]) do :ok else - errors(conn, {:error, "To use this endpoint you need to enable dynamic configuration."}) + errors( + conn, + {:error, "To use this endpoint you need to enable configuration from database."} + ) end end diff --git a/test/web/admin_api/admin_api_controller_test.exs b/test/web/admin_api/admin_api_controller_test.exs index bbaff8ed2..aae9c872a 100644 --- a/test/web/admin_api/admin_api_controller_test.exs +++ b/test/web/admin_api/admin_api_controller_test.exs @@ -1939,21 +1939,21 @@ test "returns error when status is not exist", %{conn: conn} do %{conn: assign(conn, :user, admin)} end - test "when dynamic configuration is off", %{conn: conn} do + test "when configuration from database is off", %{conn: conn} do initial = Pleroma.Config.get([:configurable_from_database]) Pleroma.Config.put([:configurable_from_database], false) on_exit(fn -> Pleroma.Config.put([:configurable_from_database], initial) end) conn = get(conn, "/api/pleroma/admin/config") assert json_response(conn, 400) == - "To use this endpoint you need to enable dynamic configuration." + "To use this endpoint you need to enable configuration from database." end test "without any settings in db", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/config") assert json_response(conn, 400) == - "To use dynamic configuration migrate your settings to database." + "To use configuration from database migrate your settings to database." end test "with settings in db", %{conn: conn} do @@ -1990,7 +1990,7 @@ test "POST /api/pleroma/admin/config error" do |> post("/api/pleroma/admin/config", %{"configs" => []}) assert json_response(conn, 400) == - "To use this endpoint you need to enable dynamic configuration." + "To use this endpoint you need to enable configuration from database." end describe "POST /api/pleroma/admin/config" do @@ -2928,7 +2928,7 @@ test "transfer settings to DB and to file", %{conn: conn} do assert Repo.all(Pleroma.Web.AdminAPI.Config) == [] end - test "returns error if dynamic configuration is off", %{conn: conn} do + test "returns error if configuration from database is off", %{conn: conn} do initial = Pleroma.Config.get([:configurable_from_database]) on_exit(fn -> Pleroma.Config.put([:configurable_from_database], initial) end) Pleroma.Config.put([:configurable_from_database], false) @@ -2936,7 +2936,7 @@ test "returns error if dynamic configuration is off", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/config/migrate_from_db") assert json_response(conn, 400) == - "To use this endpoint you need to enable dynamic configuration." + "To use this endpoint you need to enable configuration from database." end end