From 6621710deb7d626649af4eed4619d0fc3c6e2d9c Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 25 Feb 2022 02:29:10 +0800 Subject: Fix update user (#18878) --- models/user/user.go | 7 ++++--- 1 file 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 + } } } -- cgit v1.2.3