mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
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:
parent
332b2ecd21
commit
06e4687cec
54 changed files with 275 additions and 245 deletions
|
@ -402,7 +402,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
|
|||
// Now we need to assert that the ctx.Doer has permission to read
|
||||
// the baseRepo's code and pulls
|
||||
// (NOT headRepo's)
|
||||
permBase, err := models.GetUserRepoPermission(baseRepo, ctx.Doer)
|
||||
permBase, err := models.GetUserRepoPermission(ctx, baseRepo, ctx.Doer)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserRepoPermission", err)
|
||||
return nil
|
||||
|
@ -421,7 +421,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
|
|||
// If we're not merging from the same repo:
|
||||
if !isSameRepo {
|
||||
// Assert ctx.Doer has permission to read headRepo's codes
|
||||
permHead, err := models.GetUserRepoPermission(ci.HeadRepo, ctx.Doer)
|
||||
permHead, err := models.GetUserRepoPermission(ctx, ci.HeadRepo, ctx.Doer)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserRepoPermission", err)
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue