Commit 84ec0fbe authored by Haelwenn's avatar Haelwenn
Browse files

Merge branch 'show_frontends_also_when_no_static_frontends_folder_is_created_yet' into 'develop'

List available frontends also when no static/frontends folder is present yet

Closes admin-fe#201

See merge request !3510
parents 2d9f803d f9bafc17
Pipeline #37152 passed with stages
in 85 minutes and 28 seconds
...@@ -35,6 +35,12 @@ def install(%{body_params: params} = conn, _params) do ...@@ -35,6 +35,12 @@ def install(%{body_params: params} = conn, _params) do
end end
defp installed do defp installed do
File.ls!(Pleroma.Frontend.dir()) frontend_directory = Pleroma.Frontend.dir()
if File.exists?(frontend_directory) do
File.ls!(frontend_directory)
else
[]
end
end end
end end
...@@ -42,6 +42,20 @@ test "it lists available frontends", %{conn: conn} do ...@@ -42,6 +42,20 @@ test "it lists available frontends", %{conn: conn} do
refute Enum.any?(response, fn frontend -> frontend["installed"] == true end) refute Enum.any?(response, fn frontend -> frontend["installed"] == true end)
end end
test "it lists available frontends when no frontend folder was created yet", %{conn: conn} do
File.rm_rf(@dir)
response =
conn
|> get("/api/pleroma/admin/frontends")
|> json_response_and_validate_schema(:ok)
assert Enum.map(response, & &1["name"]) ==
Enum.map(Config.get([:frontends, :available]), fn {_, map} -> map["name"] end)
refute Enum.any?(response, fn frontend -> frontend["installed"] == true end)
end
end end
describe "POST /api/pleroma/admin/frontends/install" do describe "POST /api/pleroma/admin/frontends/install" do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment