mirror of
https://git.youjo.love/youjo/youjo-be.git
synced 2024-11-20 05:49:54 +01:00
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 pleroma/pleroma!3510
This commit is contained in:
commit
84ec0fbeaa
2 changed files with 21 additions and 1 deletions
|
@ -35,6 +35,12 @@ defmodule Pleroma.Web.AdminAPI.FrontendController do
|
|||
end
|
||||
|
||||
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
|
||||
|
|
|
@ -42,6 +42,20 @@ defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do
|
|||
|
||||
refute Enum.any?(response, fn frontend -> frontend["installed"] == true 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
|
||||
|
||||
describe "POST /api/pleroma/admin/frontends/install" do
|
||||
|
|
Loading…
Reference in a new issue