Merge branch 'bugfix/408' into 'develop'

ensure user info is populated when registering users

See merge request pleroma/pleroma!500
This commit is contained in:
lambda 2018-12-05 08:28:14 +00:00
commit 22eff17912
2 changed files with 13 additions and 0 deletions

View File

@ -177,6 +177,7 @@ def register_changeset(struct, params \\ %{}) do
|> validate_format(:email, @email_regex)
|> validate_length(:bio, max: 1000)
|> validate_length(:name, min: 1, max: 100)
|> put_change(:info, %Pleroma.User.Info{})
if changeset.valid? do
hashed = Pbkdf2.hashpwsalt(changeset.changes[:password])

View File

@ -149,6 +149,18 @@ test "it sets the password_hash, ap_id and following fields" do
assert changeset.changes.follower_address == "#{changeset.changes.ap_id}/followers"
end
test "it ensures info is not nil" do
changeset = User.register_changeset(%User{}, @full_user_data)
assert changeset.valid?
{:ok, user} =
changeset
|> Repo.insert()
refute is_nil(user.info)
end
end
describe "fetching a user from nickname or trying to build one" do