0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-23 10:44:44 +01:00

Don't update email for organisation (#18905)

- Fix regression caused by: f1b1472632
- Don't try to insert a email for Organisation(as they don't have one).
- Resolves #18891

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Gusted 2022-02-26 02:38:08 +00:00 committed by GitHub
parent fd273b05b9
commit 33e19c8004
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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