Merge branch 'tusooa/3055-instance-languages' into 'develop'
Allow customizing instance languages Closes #3055 See merge request pleroma/pleroma!3835
This commit is contained in:
commit
724bf7c647
3 changed files with 24 additions and 1 deletions
|
@ -1052,6 +1052,15 @@
|
||||||
description:
|
description:
|
||||||
"Minimum required age (in days) for users to create account. Only used if birthday is required.",
|
"Minimum required age (in days) for users to create account. Only used if birthday is required.",
|
||||||
suggestions: [6570]
|
suggestions: [6570]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :languages,
|
||||||
|
type: {:list, :string},
|
||||||
|
description:
|
||||||
|
"Languages to be exposed in /api/v1/instance. Should be in the format of BCP47 language codes.",
|
||||||
|
suggestions: [
|
||||||
|
"en"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,7 +27,7 @@ def render("show.json", _) do
|
||||||
thumbnail:
|
thumbnail:
|
||||||
URI.merge(Pleroma.Web.Endpoint.url(), Keyword.get(instance, :instance_thumbnail))
|
URI.merge(Pleroma.Web.Endpoint.url(), Keyword.get(instance, :instance_thumbnail))
|
||||||
|> to_string,
|
|> to_string,
|
||||||
languages: ["en"],
|
languages: Keyword.get(instance, :languages, ["en"]),
|
||||||
registrations: Keyword.get(instance, :registrations_open),
|
registrations: Keyword.get(instance, :registrations_open),
|
||||||
approval_required: Keyword.get(instance, :account_approval_required),
|
approval_required: Keyword.get(instance, :account_approval_required),
|
||||||
# Extra (not present in Mastodon):
|
# Extra (not present in Mastodon):
|
||||||
|
|
|
@ -92,4 +92,18 @@ test "get peers", %{conn: conn} do
|
||||||
|
|
||||||
assert ["peer1.com", "peer2.com"] == Enum.sort(result)
|
assert ["peer1.com", "peer2.com"] == Enum.sort(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "instance languages", %{conn: conn} do
|
||||||
|
assert %{"languages" => ["en"]} =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/instance")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
clear_config([:instance, :languages], ["aa", "bb"])
|
||||||
|
|
||||||
|
assert %{"languages" => ["aa", "bb"]} =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/instance")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue