forked from AkkomaGang/akkoma
more renamings
This commit is contained in:
parent
eadb674c41
commit
d933fd3d61
3 changed files with 18 additions and 12 deletions
|
@ -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: [
|
||||||
|
|
|
@ -802,7 +802,10 @@ def config_show(conn, _params) 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 @@ defp configurable_from_database(conn) 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
|
||||||
|
|
||||||
|
|
|
@ -1939,21 +1939,21 @@ test "returns error when status is not exist", %{conn: conn} 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 @@ test "POST /api/pleroma/admin/config error" 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 @@ test "transfer settings to DB and to file", %{conn: conn} 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 @@ test "returns error if dynamic configuration is off", %{conn: conn} 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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue