forked from AkkomaGang/akkoma
removing confusing error
This commit is contained in:
parent
15cb1f6804
commit
c85aa6e87f
3 changed files with 29 additions and 51 deletions
|
@ -689,7 +689,6 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
|||
- Response:
|
||||
- On failure:
|
||||
- 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
|
||||
{
|
||||
|
|
|
@ -797,29 +797,16 @@ def config_show(conn, %{"only_db" => true}) do
|
|||
with :ok <- configurable_from_database(conn) do
|
||||
configs = Pleroma.Repo.all(ConfigDB)
|
||||
|
||||
if configs == [] do
|
||||
errors(
|
||||
conn,
|
||||
{:error, "To use configuration from database migrate your settings to database."}
|
||||
)
|
||||
else
|
||||
conn
|
||||
|> put_view(ConfigView)
|
||||
|> render("index.json", %{configs: configs})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def config_show(conn, _params) do
|
||||
with :ok <- configurable_from_database(conn) do
|
||||
configs = ConfigDB.get_all_as_keyword()
|
||||
|
||||
if configs == [] do
|
||||
errors(
|
||||
conn,
|
||||
{:error, "To use configuration from database migrate your settings to database."}
|
||||
)
|
||||
else
|
||||
merged =
|
||||
Pleroma.Config.Holder.config()
|
||||
|> ConfigDB.merge(configs)
|
||||
|
@ -854,7 +841,6 @@ def config_show(conn, _params) do
|
|||
json(conn, %{configs: merged})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def config_update(conn, %{"configs" => configs}) do
|
||||
with :ok <- configurable_from_database(conn) do
|
||||
|
|
|
@ -1899,13 +1899,6 @@ test "when configuration from database is off", %{conn: conn} do
|
|||
"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 configuration from database migrate your settings to database."
|
||||
end
|
||||
|
||||
test "with settings only in db", %{conn: conn} do
|
||||
config1 = insert(:config)
|
||||
config2 = insert(:config)
|
||||
|
|
Loading…
Reference in a new issue