mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Pass correct context (#18638)
- Pass the correct context into `db.GetEngine()`. - Introduced in: https://github.com/go-gitea/gitea/pull/18604
This commit is contained in:
		@@ -1028,7 +1028,7 @@ func GetUserNamesByIDs(ids []int64) ([]string, error) {
 | 
			
		||||
// GetUserNameByID returns username for the id
 | 
			
		||||
func GetUserNameByID(ctx context.Context, id int64) (string, error) {
 | 
			
		||||
	var name string
 | 
			
		||||
	has, err := db.GetEngine(db.DefaultContext).Table("user").Where("id = ?", id).Cols("name").Get(&name)
 | 
			
		||||
	has, err := db.GetEngine(ctx).Table("user").Where("id = ?", id).Cols("name").Get(&name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user