more renamings

This commit is contained in:
Alexander Strizhakov 2020-01-10 19:49:40 +03:00
parent eadb674c41
commit d933fd3d61
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
3 changed files with 18 additions and 12 deletions

View File

@ -674,7 +674,7 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs`
- Params: none - Params: none
- Response: - Response:
- On failure: - 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 ```json
{} {}
@ -689,8 +689,8 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs`
- Params: none - Params: none
- Response: - Response:
- On failure: - 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."`
- 400 Bad Request `"To use dynamic configuration migrate your settings to database."` - 400 Bad Request `"To use configuration from database migrate your settings to database."`
```json ```json
{ {
@ -826,7 +826,7 @@ config :quack,
- Response: - Response:
- On failure: - 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 ```json
{ {
configs: [ configs: [

View File

@ -802,7 +802,10 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
configs = Pleroma.Repo.all(Config) configs = Pleroma.Repo.all(Config)
if configs == [] do 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 else
conn conn
|> put_view(ConfigView) |> put_view(ConfigView)
@ -847,7 +850,10 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
if Pleroma.Config.get([:configurable_from_database]) do if Pleroma.Config.get([:configurable_from_database]) do
:ok :ok
else 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
end end

View File

@ -1939,21 +1939,21 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
%{conn: assign(conn, :user, admin)} %{conn: assign(conn, :user, admin)}
end 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]) initial = Pleroma.Config.get([:configurable_from_database])
Pleroma.Config.put([:configurable_from_database], false) Pleroma.Config.put([:configurable_from_database], false)
on_exit(fn -> Pleroma.Config.put([:configurable_from_database], initial) end) on_exit(fn -> Pleroma.Config.put([:configurable_from_database], initial) end)
conn = get(conn, "/api/pleroma/admin/config") conn = get(conn, "/api/pleroma/admin/config")
assert json_response(conn, 400) == 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
test "without any settings in db", %{conn: conn} do test "without any settings in db", %{conn: conn} do
conn = get(conn, "/api/pleroma/admin/config") conn = get(conn, "/api/pleroma/admin/config")
assert json_response(conn, 400) == 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 end
test "with settings in db", %{conn: conn} do test "with settings in db", %{conn: conn} do
@ -1990,7 +1990,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|> post("/api/pleroma/admin/config", %{"configs" => []}) |> post("/api/pleroma/admin/config", %{"configs" => []})
assert json_response(conn, 400) == 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
describe "POST /api/pleroma/admin/config" do describe "POST /api/pleroma/admin/config" do
@ -2928,7 +2928,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
assert Repo.all(Pleroma.Web.AdminAPI.Config) == [] assert Repo.all(Pleroma.Web.AdminAPI.Config) == []
end 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]) initial = Pleroma.Config.get([:configurable_from_database])
on_exit(fn -> Pleroma.Config.put([:configurable_from_database], initial) end) on_exit(fn -> Pleroma.Config.put([:configurable_from_database], initial) end)
Pleroma.Config.put([:configurable_from_database], false) Pleroma.Config.put([:configurable_from_database], false)
@ -2936,7 +2936,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
conn = get(conn, "/api/pleroma/admin/config/migrate_from_db") conn = get(conn, "/api/pleroma/admin/config/migrate_from_db")
assert json_response(conn, 400) == 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
end end