forked from forgejo/forgejo
Add context parameter to some database functions (#26055)
To avoid deadlock problem, almost database related functions should be have ctx as the first parameter. This PR do a refactor for some of these functions.
This commit is contained in:
parent
c42b71877e
commit
b167f35113
50 changed files with 209 additions and 237 deletions
|
@ -386,7 +386,7 @@ func reqRepoWriter(unitTypes ...unit.Type) func(ctx *context.APIContext) {
|
|||
// reqRepoBranchWriter user should have a permission to write to a branch, or be a site admin
|
||||
func reqRepoBranchWriter(ctx *context.APIContext) {
|
||||
options, ok := web.GetForm(ctx).(api.FileOptionInterface)
|
||||
if !ok || (!ctx.Repo.CanWriteToBranch(ctx.Doer, options.Branch()) && !ctx.IsUserSiteAdmin()) {
|
||||
if !ok || (!ctx.Repo.CanWriteToBranch(ctx, ctx.Doer, options.Branch()) && !ctx.IsUserSiteAdmin()) {
|
||||
ctx.Error(http.StatusForbidden, "reqRepoBranchWriter", "user should have a permission to write to this branch")
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue