Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Feb 17, 2022
1 parent 4af826e commit 37d8a7b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions models/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -862,19 +862,18 @@ func updateUser(ctx context.Context, u *User, changePrimaryEmail bool, cols ...s
return err
}
} else { // check if primary email in email_address table
primaryEmailExist, err := e.Where("uid=? AND is_primary=?", u.ID, true).Exist(EmailAddress{})
primaryEmailExist, err := e.Where("uid=? AND is_primary=?", u.ID, true).Exist(&EmailAddress{})
if err != nil {
return err
}

if !primaryEmailExist {
var emailAddress = EmailAddress{
_, err = e.Insert(&EmailAddress{
Email: u.Email,
UID: u.ID,
IsActivated: true,
IsPrimary: true,
}
_, err = e.Insert(&emailAddress)
})
return err
}
}
Expand Down

0 comments on commit 37d8a7b

Please sign in to comment.