Skip to content

Commit

Permalink
Don't update email for organisation (go-gitea#18905)
Browse files Browse the repository at this point in the history
- Fix regression caused by: f1b1472
- Don't try to insert a email for Organisation(as they don't have one).
- Resolves go-gitea#18891

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
  • Loading branch information
2 people authored and Stelios Malathouras committed Mar 28, 2022
1 parent a6dda26 commit 2ca69ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ func updateUser(ctx context.Context, u *User, changePrimaryEmail bool, cols ...s
}); err != nil {
return err
}
} else { // check if primary email in email_address table
} else if !u.IsOrganization() { // check if primary email in email_address table
primaryEmailExist, err := e.Where("uid=? AND is_primary=?", u.ID, true).Exist(&EmailAddress{})
if err != nil {
return err
Expand Down

0 comments on commit 2ca69ba

Please sign in to comment.