diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-02-25 02:29:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-24 19:29:10 +0100 |
commit | 6621710deb7d626649af4eed4619d0fc3c6e2d9c (patch) | |
tree | c7e637b7be5b17f915fb59f9e545cae9a47aea42 /models | |
parent | f1b1472632e36c3bb5df73f184a6efeef47f5d01 (diff) | |
download | gitea-6621710deb7d626649af4eed4619d0fc3c6e2d9c.tar.gz gitea-6621710deb7d626649af4eed4619d0fc3c6e2d9c.zip |
Fix update user (#18878)
Diffstat (limited to 'models')
-rw-r--r-- | models/user/user.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/models/user/user.go b/models/user/user.go index d0f1d9d747..e581067bbd 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -868,13 +868,14 @@ func updateUser(ctx context.Context, u *User, changePrimaryEmail bool, cols ...s } if !primaryEmailExist { - _, err = e.Insert(&EmailAddress{ + if _, err := e.Insert(&EmailAddress{ Email: u.Email, UID: u.ID, IsActivated: true, IsPrimary: true, - }) - return err + }); err != nil { + return err + } } } |