From: FloatingGhost Date: Sun, 6 Nov 2022 22:55:26 +0000 (+0000) Subject: Add enabled check on /translation/languages X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=5123b3a5dd9683441f5b4e904deda89fd40098ac;p=akkoma Add enabled check on /translation/languages --- diff --git a/lib/pleroma/web/akkoma_api/controllers/translation_controller.ex b/lib/pleroma/web/akkoma_api/controllers/translation_controller.ex index 9983a7e39..ca9b4b64a 100644 --- a/lib/pleroma/web/akkoma_api/controllers/translation_controller.ex +++ b/lib/pleroma/web/akkoma_api/controllers/translation_controller.ex @@ -21,10 +21,12 @@ defmodule Pleroma.Web.AkkomaAPI.TranslationController do @doc "GET /api/v1/akkoma/translation/languages" def languages(conn, _params) do - with {:ok, source_languages, dest_languages} <- get_languages() do + with {:enabled, true} <- {:enabled, Pleroma.Config.get([:translator, :enabled])}, + {:ok, source_languages, dest_languages} <- get_languages() do conn |> json(%{source: source_languages, target: dest_languages}) else + {:enabled, false} -> json(conn, %{}) e -> IO.inspect(e) end end