diff options
author | 6543 <6543@obermui.de> | 2022-04-28 13:48:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-28 13:48:48 +0200 |
commit | 06e4687cecaed41500b653e5b8685f48b8b18310 (patch) | |
tree | a98dd6d0139ba5d89c7e08d3c52930d66a77119b /routers/private | |
parent | 332b2ecd214a79b49f3798f4f27fe02b23a17bf8 (diff) | |
download | gitea-06e4687cecaed41500b653e5b8685f48b8b18310.tar.gz gitea-06e4687cecaed41500b653e5b8685f48b8b18310.zip |
more context for models (#19511)
make more usage of context, to have more db transaction in one session
(make diff of #9307 smaller)
Diffstat (limited to 'routers/private')
-rw-r--r-- | routers/private/hook_pre_receive.go | 4 | ||||
-rw-r--r-- | routers/private/serv.go | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/routers/private/hook_pre_receive.go b/routers/private/hook_pre_receive.go index 763fe1cf1c..ccb6933787 100644 --- a/routers/private/hook_pre_receive.go +++ b/routers/private/hook_pre_receive.go @@ -290,7 +290,7 @@ func preReceiveBranch(ctx *preReceiveContext, oldCommitID, newCommitID, refFullN // 6b. Merge (from UI or API) // Get the PR, user and permissions for the user in the repository - pr, err := models.GetPullRequestByID(ctx.opts.PullRequestID) + pr, err := models.GetPullRequestByID(ctx, ctx.opts.PullRequestID) if err != nil { log.Error("Unable to get PullRequest %d Error: %v", ctx.opts.PullRequestID, err) ctx.JSON(http.StatusInternalServerError, private.Response{ @@ -468,7 +468,7 @@ func (ctx *preReceiveContext) loadPusherAndPermission() bool { } ctx.user = user - userPerm, err := models.GetUserRepoPermission(ctx.Repo.Repository, user) + userPerm, err := models.GetUserRepoPermission(ctx, ctx.Repo.Repository, user) if err != nil { log.Error("Unable to get Repo permission of repo %s/%s of User %s", ctx.Repo.Repository.OwnerName, ctx.Repo.Repository.Name, user.Name, err) ctx.JSON(http.StatusInternalServerError, private.Response{ diff --git a/routers/private/serv.go b/routers/private/serv.go index b0451df5d8..6ef0079a2b 100644 --- a/routers/private/serv.go +++ b/routers/private/serv.go @@ -320,7 +320,7 @@ func ServCommand(ctx *context.PrivateContext) { mode = perm.AccessModeRead } - perm, err := models.GetUserRepoPermission(repo, user) + perm, err := models.GetUserRepoPermission(ctx, repo, user) if err != nil { log.Error("Unable to get permissions for %-v with key %d in %-v Error: %v", user, key.ID, repo, err) ctx.JSON(http.StatusInternalServerError, private.ErrServCommand{ |