adding path field to description tabs

This commit is contained in:
Alexander Strizhakov 2021-03-04 13:21:28 +03:00
parent f20c1afe46
commit 957a51058b
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
5 changed files with 29 additions and 28 deletions

View File

@ -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, [

View File

@ -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

View File

@ -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 """

View File

@ -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()

View File

@ -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"]