Skip to content

Commit 37d8a7b

Browse files
committed
Fix test
1 parent 4af826e commit 37d8a7b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

models/user/user.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,19 +862,18 @@ func updateUser(ctx context.Context, u *User, changePrimaryEmail bool, cols ...s
862862
return err
863863
}
864864
} else { // check if primary email in email_address table
865-
primaryEmailExist, err := e.Where("uid=? AND is_primary=?", u.ID, true).Exist(EmailAddress{})
865+
primaryEmailExist, err := e.Where("uid=? AND is_primary=?", u.ID, true).Exist(&EmailAddress{})
866866
if err != nil {
867867
return err
868868
}
869869

870870
if !primaryEmailExist {
871-
var emailAddress = EmailAddress{
871+
_, err = e.Insert(&EmailAddress{
872872
Email: u.Email,
873873
UID: u.ID,
874874
IsActivated: true,
875875
IsPrimary: true,
876-
}
877-
_, err = e.Insert(&emailAddress)
876+
})
878877
return err
879878
}
880879
}

0 commit comments

Comments
 (0)