Commit 22eff179 authored by lain's avatar lain
Browse files

Merge branch 'bugfix/408' into 'develop'

ensure user info is populated when registering users

See merge request !500
parents ec1ec32f 0f061bea
Pipeline #4951 passed with stages
in 5 minutes and 9 seconds
......@@ -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])
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment