Add configurable length limits for User.bio and User.name

This commit is contained in:
Egor Kislitsyn 2019-08-01 15:53:37 +07:00
commit 9ca4506355
4 changed files with 29 additions and 18 deletions

View file

@ -525,7 +525,10 @@ defmodule Pleroma.UserTest do
end
test "it restricts some sizes" do
[bio: 5000, name: 100]
bio_limit = Pleroma.Config.get([:instance, :user_bio_length], 5000)
name_limit = Pleroma.Config.get([:instance, :user_name_length], 100)
[bio: bio_limit, name: name_limit]
|> Enum.each(fn {field, size} ->
string = String.pad_leading(".", size)
cs = User.remote_user_creation(Map.put(@valid_remote, field, string))