Merge branch 'restrict-unauthenticated' into 'develop'
InstanceView: expose restrict_unauthenticated settings See merge request soapbox-pub/rebased!280
This commit is contained in:
commit
374b099825
2 changed files with 26 additions and 0 deletions
|
@ -252,6 +252,21 @@ defp configuration2 do
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp restrict_unauthenticated do
|
||||||
|
Config.get([:restrict_unauthenticated])
|
||||||
|
|> Enum.map(fn {category, features} ->
|
||||||
|
features =
|
||||||
|
Enum.map(features, fn
|
||||||
|
{feature, is_enabled} when is_boolean(is_enabled) -> {feature, is_enabled}
|
||||||
|
{feature, :if_instance_is_private} -> {feature, !Config.get!([:instance, :public])}
|
||||||
|
end)
|
||||||
|
|> Enum.into(%{})
|
||||||
|
|
||||||
|
{category, features}
|
||||||
|
end)
|
||||||
|
|> Enum.into(%{})
|
||||||
|
end
|
||||||
|
|
||||||
defp pleroma_configuration(instance) do
|
defp pleroma_configuration(instance) do
|
||||||
%{
|
%{
|
||||||
metadata: %{
|
metadata: %{
|
||||||
|
@ -264,6 +279,7 @@ defp pleroma_configuration(instance) do
|
||||||
birthday_required: Config.get([:instance, :birthday_required]),
|
birthday_required: Config.get([:instance, :birthday_required]),
|
||||||
birthday_min_age: Config.get([:instance, :birthday_min_age]),
|
birthday_min_age: Config.get([:instance, :birthday_min_age]),
|
||||||
migration_cooldown_period: Config.get([:instance, :migration_cooldown_period]),
|
migration_cooldown_period: Config.get([:instance, :migration_cooldown_period]),
|
||||||
|
restrict_unauthenticated: restrict_unauthenticated(),
|
||||||
translation: translation_configuration(),
|
translation: translation_configuration(),
|
||||||
markup: markup()
|
markup: markup()
|
||||||
},
|
},
|
||||||
|
|
|
@ -204,4 +204,14 @@ test "translation languages matrix", %{conn: conn} do
|
||||||
|> get("/api/v1/instance/translation_languages")
|
|> get("/api/v1/instance/translation_languages")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "restrict_unauthenticated", %{conn: conn} do
|
||||||
|
result =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/instance")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
assert result["pleroma"]["metadata"]["restrict_unauthenticated"]["timelines"]["local"] ==
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue