mirror of
https://github.com/go-gitea/gitea
synced 2025-11-01 03:48:24 +00:00
Merge branch 'main' into feature/bots
This commit is contained in:
@@ -967,12 +967,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 {
|
||||
@@ -1164,7 +1159,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:
|
||||
@@ -1208,7 +1203,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}
|
||||
|
||||
Reference in New Issue
Block a user