summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-02-26 02:38:08 +0000
committerGitHub <noreply@github.com>2022-02-26 10:38:08 +0800
commit33e19c800458bd7c03bc51772537944eb95975ae (patch)
tree32b52ee52b4b30904b774be0012fdc2656678f6e /models
parentfd273b05b9513e4ac1b0d7b743acc3c3d36c905c (diff)
downloadgitea-33e19c800458bd7c03bc51772537944eb95975ae.tar.gz
gitea-33e19c800458bd7c03bc51772537944eb95975ae.zip
Don't update email for organisation (#18905)
- Fix regression caused by: f1b1472632e36c3bb5df73f184a6efeef47f5d01 - 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>
Diffstat (limited to 'models')
-rw-r--r--models/user/user.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models/user/user.go b/models/user/user.go
index e581067bbd..3eabf4808c 100644
--- a/models/user/user.go
+++ b/models/user/user.go
@@ -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