1
Fork 0

more context for models (#19511)

make more usage of context, to have more db transaction in one session

(make diff of  #9307 smaller)
This commit is contained in:
6543 2022-04-28 13:48:48 +02:00 committed by GitHub
parent 332b2ecd21
commit 06e4687cec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 275 additions and 245 deletions

View file

@ -88,7 +88,7 @@ func GetListLockHandler(ctx *context.Context) {
})
return
}
lock, err := models.GetLFSLockByID(v)
lock, err := models.GetLFSLockByID(ctx, v)
if err != nil && !models.IsErrLFSLockNotExist(err) {
log.Error("Unable to get lock with ID[%s]: Error: %v", v, err)
}
@ -98,7 +98,7 @@ func GetListLockHandler(ctx *context.Context) {
path := ctx.FormString("path")
if path != "" { // Case where we request a specific id
lock, err := models.GetLFSLock(repository, path)
lock, err := models.GetLFSLock(ctx, repository, path)
if err != nil && !models.IsErrLFSLockNotExist(err) {
log.Error("Unable to get lock for repository %-v with path %s: Error: %v", repository, path, err)
}

View file

@ -488,7 +488,7 @@ func authenticate(ctx *context.Context, repository *repo_model.Repository, autho
}
// ctx.IsSigned is unnecessary here, this will be checked in perm.CanAccess
perm, err := models.GetUserRepoPermission(repository, ctx.Doer)
perm, err := models.GetUserRepoPermission(ctx, repository, ctx.Doer)
if err != nil {
log.Error("Unable to GetUserRepoPermission for user %-v in repo %-v Error: %v", ctx.Doer, repository)
return false