aboutsummaryrefslogtreecommitdiffstats
path: root/models/user/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/user/user.go')
-rw-r--r--models/user/user.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/models/user/user.go b/models/user/user.go
index 915e4243cf..71b036b06f 100644
--- a/models/user/user.go
+++ b/models/user/user.go
@@ -993,12 +993,7 @@ func UserPath(userName string) string { //revive:disable-line:exported
}
// GetUserByID returns the user object by given ID if exists.
-func GetUserByID(id int64) (*User, error) {
- return GetUserByIDCtx(db.DefaultContext, id)
-}
-
-// GetUserByIDCtx returns the user object by given ID if exists.
-func GetUserByIDCtx(ctx context.Context, id int64) (*User, error) {
+func GetUserByID(ctx context.Context, id int64) (*User, error) {
u := new(User)
has, err := db.GetEngine(ctx).ID(id).Get(u)
if err != nil {
@@ -1176,7 +1171,7 @@ func GetUserByEmailContext(ctx context.Context, email string) (*User, error) {
return nil, err
}
if has {
- return GetUserByIDCtx(ctx, emailAddress.UID)
+ return GetUserByID(ctx, emailAddress.UID)
}
// Finally, if email address is the protected email address:
@@ -1220,7 +1215,7 @@ func GetUserByOpenID(uri string) (*User, error) {
return nil, err
}
if has {
- return GetUserByID(oid.UID)
+ return GetUserByID(db.DefaultContext, oid.UID)
}
return nil, ErrUserNotExist{0, uri, 0}