Pass correct context (#18638)

- Pass the correct context into `db.GetEngine()`.
- Introduced in: https://github.com/go-gitea/gitea/pull/18604
pull/18615/head
Gusted 3 years ago committed by GitHub
parent ce8eb20a00
commit 7a42e35741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      models/user/user.go

@ -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
}

Loading…
Cancel
Save