mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	code fix #941 caution: undertest
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user