Merge branch 'description-limits' into 'develop'

Add limits to image descriptions

See merge request pleroma/pleroma!2724
This commit is contained in:
Haelwenn 2020-07-07 03:00:52 +00:00
commit d81acb5f62
8 changed files with 31 additions and 2 deletions

View file

@ -107,6 +107,19 @@ defmodule Pleroma.UploadTest do
describe "Storing a file with the Local uploader" do
setup [:ensure_local_uploader]
test "does not allow descriptions longer than the post limit" do
clear_config([:instance, :description_limit], 2)
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
content_type: "image/jpg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "image.jpg"
}
{:error, :description_too_long} = Upload.store(file, description: "123")
end
test "returns a media url" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")

View file

@ -32,7 +32,9 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
"avatar_upload_limit" => _,
"background_upload_limit" => _,
"banner_upload_limit" => _,
"background_image" => _
"background_image" => _,
"chat_limit" => _,
"description_limit" => _
} = result
assert result["pleroma"]["metadata"]["account_activation_required"] != nil