Add tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
90f91168f7
commit
90f590788c
5 changed files with 97 additions and 4 deletions
|
|
@ -3,7 +3,6 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Translation do
|
||||
@cache_ttl 86_400_000
|
||||
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
|
||||
|
||||
def configured? do
|
||||
|
|
@ -45,7 +44,7 @@ defmodule Pleroma.Translation do
|
|||
end
|
||||
|
||||
defp store_result({:ok, result}, cache_key) do
|
||||
@cachex.put(:translations_cache, cache_key, result, ttl: @cache_ttl)
|
||||
@cachex.put(:translations_cache, cache_key, result)
|
||||
end
|
||||
|
||||
defp store_result(_, _), do: nil
|
||||
|
|
|
|||
|
|
@ -129,7 +129,10 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
|
|||
"profile_directory"
|
||||
end,
|
||||
"pleroma:get:main/ostatus",
|
||||
"pleroma:group_actors"
|
||||
"pleroma:group_actors",
|
||||
if Pleroma.Translation.configured?() do
|
||||
"translation"
|
||||
end
|
||||
]
|
||||
|> Enum.filter(& &1)
|
||||
end
|
||||
|
|
@ -203,7 +206,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
|
|||
vapid: %{
|
||||
public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
|
||||
},
|
||||
translation: %{enabled: Pleroma.Translation.configured?}
|
||||
translation: %{enabled: Pleroma.Translation.configured?()}
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue