mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-18 17:00:02 +02:00
code fix #941 caution: undertest
This commit is contained in:
parent
b99c4baab2
commit
6d0f3a07d4
10 changed files with 310 additions and 260 deletions
|
@ -521,10 +521,9 @@ func GetUserByKeyId(keyId int64) (*User, error) {
|
|||
return user, nil
|
||||
}
|
||||
|
||||
// GetUserById returns the user object by given ID if exists.
|
||||
func GetUserById(id int64) (*User, error) {
|
||||
func getUserById(e Engine, id int64) (*User, error) {
|
||||
u := new(User)
|
||||
has, err := x.Id(id).Get(u)
|
||||
has, err := e.Id(id).Get(u)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
|
@ -533,6 +532,11 @@ func GetUserById(id int64) (*User, error) {
|
|||
return u, nil
|
||||
}
|
||||
|
||||
// GetUserById returns the user object by given ID if exists.
|
||||
func GetUserById(id int64) (*User, error) {
|
||||
return getUserById(x, id)
|
||||
}
|
||||
|
||||
// GetUserByName returns user by given name.
|
||||
func GetUserByName(name string) (*User, error) {
|
||||
if len(name) == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue