From 5123b3a5dd9683441f5b4e904deda89fd40098ac Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Sun, 6 Nov 2022 22:55:26 +0000 Subject: [PATCH] Add enabled check on /translation/languages --- .../web/akkoma_api/controllers/translation_controller.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.45.2