diff --git a/config/description.exs b/config/description.exs index 533ba711c..c06bace50 100644 --- a/config/description.exs +++ b/config/description.exs @@ -70,26 +70,26 @@ frontend_options = [ ] config :pleroma, :tabs, [ - %{tab: :activity_pub, label: "ActivityPub"}, - %{tab: :authentication, label: "Authentication"}, - %{tab: :captcha, label: "Captcha"}, - %{tab: :esshd, label: "BBS / SSH access"}, - %{tab: :emoji, label: "Emoji"}, - %{tab: :frontend, label: "Frontend"}, - %{tab: :gopher, label: "Gopher"}, - %{tab: :http, label: "HTTP"}, - %{tab: :instance, label: "Instance"}, - %{tab: :job_queue, label: "Job queue"}, - %{tab: :link_formatter, label: "Link Formatter"}, - %{tab: :logger, label: "Logger"}, - %{tab: :mailer, label: "Mailer"}, - %{tab: :media_proxy, label: "Media Proxy"}, - %{tab: :metadata, label: "Metadata"}, - %{tab: :mrf, label: "MRF"}, - %{tab: :rate_limiters, label: "Rate limiters"}, - %{tab: :web_push, label: "Web push encryption"}, - %{tab: :upload, label: "Upload"}, - %{tab: :other, label: "Other"} + %{tab: :activity_pub, label: "ActivityPub", path: "activity-pub"}, + %{tab: :authentication, label: "Authentication", path: "authentication"}, + %{tab: :captcha, label: "Captcha", path: "captcha"}, + %{tab: :esshd, label: "BBS / SSH access", path: "esshd"}, + %{tab: :emoji, label: "Emoji", path: "emoji"}, + %{tab: :frontend, label: "Frontend", path: "frontend"}, + %{tab: :gopher, label: "Gopher", path: "gopher"}, + %{tab: :http, label: "HTTP", path: "http"}, + %{tab: :instance, label: "Instance", path: "instance"}, + %{tab: :job_queue, label: "Job queue", path: "job-queue"}, + %{tab: :link_formatter, label: "Link Formatter", path: "link-formatter"}, + %{tab: :logger, label: "Logger", path: "logger"}, + %{tab: :mailer, label: "Mailer", path: "mailer"}, + %{tab: :media_proxy, label: "Media Proxy", path: "media-proxy"}, + %{tab: :metadata, label: "Metadata", path: "metadata"}, + %{tab: :mrf, label: "MRF", path: "mrf"}, + %{tab: :rate_limiters, label: "Rate limiters", path: "rate-limiters"}, + %{tab: :web_push, label: "Web push encryption", path: "web-push"}, + %{tab: :upload, label: "Upload", path: "upload"}, + %{tab: :other, label: "Other", path: "other"} ] config :pleroma, :config_description, [ diff --git a/docs/development/API/admin_api.md b/docs/development/API/admin_api.md index 45f470b2c..8239cce9f 100644 --- a/docs/development/API/admin_api.md +++ b/docs/development/API/admin_api.md @@ -1138,7 +1138,7 @@ Loads json generated from `config/descriptions.exs`. ```json { - "tabs": [{"tab": "activity_pub", "label": "ActivityPub"}], + "tabs": [{"tab": "activity_pub", "label": "ActivityPub", "path": "activity-pub"}], "descriptions": [ { "group": ":pleroma", // string diff --git a/lib/pleroma/web/admin_api/controllers/config_controller.ex b/lib/pleroma/web/admin_api/controllers/config_controller.ex index 1042662c7..ef9270053 100644 --- a/lib/pleroma/web/admin_api/controllers/config_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/config_controller.ex @@ -26,11 +26,7 @@ defmodule Pleroma.Web.AdminAPI.ConfigController do GET /api/v1/pleroma/admin/config/descriptions """ def descriptions(conn, _params) do - descriptions = - whitelisted_descriptions() - |> Enum.map(&Map.delete(&1, "tab")) - - json(conn, descriptions) + json(conn, whitelisted_descriptions()) end @doc """ diff --git a/lib/pleroma/web/api_spec/operations/admin/config_operation.ex b/lib/pleroma/web/api_spec/operations/admin/config_operation.ex index 0ad8937c8..752357fd8 100644 --- a/lib/pleroma/web/api_spec/operations/admin/config_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/config_operation.ex @@ -100,7 +100,11 @@ defmodule Pleroma.Web.ApiSpec.Admin.ConfigOperation do type: :array, items: %Schema{ type: :object, - properties: %{tab: %Schema{type: :string}, label: %Schema{type: :string}} + properties: %{ + tab: %Schema{type: :string}, + label: %Schema{type: :string}, + path: %Schema{type: :string} + } } }, descriptions: descriptions_schema() diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index 10cc85fd3..ad340561b 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -1431,7 +1431,8 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do json_response_and_validate_schema(conn, 200) assert Enum.all?(tabs, fn tab -> - Map.has_key?(tab, "tab") and Map.has_key?(tab, "label") + Map.has_key?(tab, "tab") and Map.has_key?(tab, "label") and + Map.has_key?(tab, "path") end) assert child["children"]