From 81e90776eea03e646a5b79b0d4fda4bbc35548d2 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sat, 26 Feb 2022 02:38:08 +0000 Subject: [PATCH] Don't update email for organisation (#18905) - Fix regression caused by: b446c71a0a37ffbc8808e59ecd99d8be7d5de990 - Don't try to insert a email for Organisation(as they don't have one). - Resolves #18891 Co-authored-by: Lunny Xiao --- models/user/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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