diff options
author | Alexander <alex.strizhakov@gmail.com> | 2019-12-20 10:22:53 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-01-10 15:52:01 +0300 |
commit | cda2c1fc630e455b3d419f5c3b22c366dc883ce1 (patch) | |
tree | 8b590d4cc01cde5a06a3b2744fce126476cc1008 | |
parent | 063ab6d9115ec17bd1907d42a998f335a0cd69c9 (diff) | |
download | pleroma-cda2c1fc630e455b3d419f5c3b22c366dc883ce1.tar.gz |
fix for subgroup tuple
added settings for swoosh adapters local
-rw-r--r-- | config/description.exs | 23 | ||||
-rw-r--r-- | lib/pleroma/docs/generator.ex | 8 | ||||
-rw-r--r-- | test/docs/generator_test.exs | 7 |
3 files changed, 37 insertions, 1 deletions
diff --git a/config/description.exs b/config/description.exs index 3abcc6266..52f7d2017 100644 --- a/config/description.exs +++ b/config/description.exs @@ -238,7 +238,8 @@ config :pleroma, :config_description, [ Swoosh.Adapters.AmazonSES, Swoosh.Adapters.Dyn, Swoosh.Adapters.SocketLabs, - Swoosh.Adapters.Gmail + Swoosh.Adapters.Gmail, + Swoosh.Adapters.Local ] }, %{ @@ -450,6 +451,26 @@ config :pleroma, :config_description, [ ] }, %{ + group: :swoosh, + type: :group, + description: "`Swoosh.Adapters.Local` adapter specific settings", + children: [ + %{ + group: {:subgroup, Swoosh.Adapters.Local}, + key: :serve_mailbox, + type: :boolean, + description: "Run the preview server together as part of your app" + }, + %{ + group: {:subgroup, Swoosh.Adapters.Local}, + key: :preview_port, + type: :integer, + description: "The preview server port", + suggestions: [4001] + } + ] + }, + %{ group: :pleroma, key: :uri_schemes, type: :group, diff --git a/lib/pleroma/docs/generator.ex b/lib/pleroma/docs/generator.ex index b57e47e8b..6b12dcdd9 100644 --- a/lib/pleroma/docs/generator.ex +++ b/lib/pleroma/docs/generator.ex @@ -58,15 +58,23 @@ defmodule Pleroma.Docs.Generator do entity |> Map.put(:suggestions, format_suggestions(suggestions)) |> format_key() + |> format_group() |> format_children() end defp format_child(entity) do entity |> format_key() + |> format_group() |> format_children() end + defp format_group(%{group: group} = entity) do + Map.put(entity, :group, format_suggestion(group)) + end + + defp format_group(entity), do: entity + defp atom_to_string(entity) when is_binary(entity), do: entity defp atom_to_string(entity) when is_atom(entity), do: inspect(entity) diff --git a/test/docs/generator_test.exs b/test/docs/generator_test.exs index 42e7c32c8..0106809c2 100644 --- a/test/docs/generator_test.exs +++ b/test/docs/generator_test.exs @@ -207,5 +207,12 @@ defmodule Pleroma.Docs.GeneratorTest do child = Enum.at(children, 7) assert child[:key] == "application/xml" end + + test "subgroup with module name" do + [%{children: children} | _] = Generator.convert_to_strings(@descriptions) + + %{group: subgroup} = Enum.at(children, 6) + assert subgroup == {":subgroup", "Swoosh.Adapters.SMTP"} + end end end |