Do not translate non-public statuses
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
90f590788c
commit
aa429f6e6a
2 changed files with 26 additions and 1 deletions
|
|
@ -2571,7 +2571,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
|> post("/api/v1/statuses/#{activity.id}/translate")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert response == %{"content" => "!ćśezC", "detected_source_language" => "pl", "provider" => "TranslationMock"}
|
||||
assert response == %{
|
||||
"content" => "!ćśezC",
|
||||
"detected_source_language" => "pl",
|
||||
"provider" => "TranslationMock"
|
||||
}
|
||||
end
|
||||
|
||||
test "it returns an error if no target language provided" do
|
||||
|
|
@ -2589,5 +2593,21 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
|> post("/api/v1/statuses/#{activity.id}/translate")
|
||||
|> json_response_and_validate_schema(400)
|
||||
end
|
||||
|
||||
test "it doesn't translate non-public statuses" do
|
||||
%{conn: conn, user: user} = oauth_access(["read:statuses"])
|
||||
|
||||
{:ok, activity} =
|
||||
CommonAPI.post(user, %{
|
||||
status: "Cześć!",
|
||||
visibility: "private",
|
||||
language: "pl"
|
||||
})
|
||||
|
||||
response =
|
||||
conn
|
||||
|> post("/api/v1/statuses/#{activity.id}/translate")
|
||||
|> json_response_and_validate_schema(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue